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 #70138 is a reply to message #70137] Tue, 16 March 2010 08:35 Go to previous messageGo to previous message
Carsten Lechte is currently offline  Carsten Lechte
Messages: 124
Registered: August 2006
Senior Member
H. Evans wrote:
> Could be either + or -ve:
> IDL> print,!values.f_nan, - !values.f_nan
> NaN -NaN

Then, a totally different approach might be necessary to get
it completely right.

FINITE() tells you if you have a NaN, but since every
comparison that involves NaNs evaluates to FALSE, you cannot
find out if it's + or -NaN be equating to !VALUES.F_NAN.

One would have to extract the sign bit (assuming IEEE format,
taking into account endianness, precision etc.) and base the
calculation on that.

For my private version, I will add a term + ( FINITE( x) EQ 0)
so all NaNs are assumed positive, since the one value that
SIGNUM( NaN) should not have is 0.

I wonder in what situation one would care about the correct sign
of something that is not a number.


chl
[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: Fri Oct 10 21:59:07 PDT 2025

Total time taken to generate the page: 1.75953 seconds