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

Home » Public Forums » archive » Re: where and NAN numbers
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: where and NAN numbers [message #42152] Wed, 12 January 2005 15:16 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
maarten wrote:
> What version are you using, because in 6.1.1. the results are:
> IDL> u = [!values.f_nan, 1, 2, 3]
> IDL> print, where(u eq 3)
> 3
> IDL> print, where(u ge 3)
> 3

The result of a comparison operation between a NaN and an "ordinary"
number will depend on the platform. (At least I vaguely recall some
dicussion of this somewhere, perhaps this group or perhaps another one.)
It is not wise to rely on getting logically consistent results. For
example on IDL 6.1.1 (win32), NaN is not equal to 0 (according to the EQ
and NE operators) but it is neither larger or smaller than 0 (according
to the LT and GT operators). So, as another poster has suggested, it is
good practice to use the FINITE function to establish whether a floating
point number is finite; if it's not the results from comparison
operations will likely be misleading.

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: DIALOG_PICKFILE Questions in IDL 6.1
Next Topic: Re: 3-d visualization (itools while in a program)

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

Current Time: Sat Oct 11 20:53:35 PDT 2025

Total time taken to generate the page: 0.47754 seconds