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

Home » Public Forums » archive » Re: SIGN function: signof(num or array of num)
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: SIGN function: signof(num or array of num) [message #70140 is a reply to message #70139] Tue, 16 March 2010 07:30 Go to previous message
H. Evans is currently offline  H. Evans
Messages: 18
Registered: December 2009
Junior Member
On Mar 16, 2:57 pm, Carsten Lechte <c...@toppoint.de> wrote:
> F LDY Lajos wrote:
>> I think SIGNOF() should not cause an arithmetic error for finite numbers.
>
> I use the expression
>
> (x GT 0) -1* (x LT 0)
>
> to get the sign of e.g.
>
> x = [ -2e4, 5, 0, 1d/0, -1d/0, 0d/0 ]
>
> but it uses 2 comparisons and even a multiplication. Does anyone have
> a simpler/faster version? Furthermore, what should the sign of NaN be?
>
> chl

Could be either + or -ve:
IDL> print,!values.f_nan, - !values.f_nan
NaN -NaN
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to read data with format codes?
Next Topic: Predefined iTool Visualization in existing iTool

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

Current Time: Sat Oct 11 06:44:20 PDT 2025

Total time taken to generate the page: 0.23336 seconds