comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » [Q]: ID analog to FORTRAN "sign" function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: [Q]: ID analog to FORTRAN "sign" function [message #21992 is a reply to message #21932] Thu, 12 October 2000 00:00 Go to previous messageGo to previous message
Phillip David is currently offline  Phillip David
Messages: 36
Registered: April 1999
Member
Dick Jackson wrote:
>
> Do I dare offer one more? Subscript lookups seem faster than arithmetic
> operations, making this one faster, more compact and no less cryptic! :-)
>
> Return, Abs(a) * ([-1, 1])[b GE 0]

to which I reply:

If this one really works, then why not go even one step further?

Return, ([-Abs(a), Abs(a)])[b GE 0]

or

Return, ([a, -a])[(a*b) LT 0]

I haven't timed either of these to find out if they're truly better (as
I don't have IDL on my newsgroup computer), but they MIGHT work
better...

Phillip
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 3D Visualization
Next Topic: Re: BINARY FILES

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 22:18:07 PDT 2025

Total time taken to generate the page: 1.03825 seconds