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

Home » Public Forums » archive » Re: VALUE_LOCATE and NaNs
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: VALUE_LOCATE and NaNs [message #81819 is a reply to message #81817] Thu, 25 October 2012 07:30 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Thursday, October 25, 2012 5:14:47 AM UTC-4, Fab wrote:
> Dear IDLers,
>
> I am quite an adept of using NaNs as missing values for my data, because
> many IDL routines go along with them. However, some of the routines are
> not really documented about how they handle NaNs.
>
> See the following example:
> IDL> data = FINDGEN(10) & data[0] = !VALUES.F_NAN
> IDL> p = VALUE_LOCATE(FINDGEN(10), data) & print, p[0]
> -1
> IDL> p = VALUE_LOCATE(INDGEN(10), data) & print, p[0]
> 0
> % Program caused arithmetic error: Floating illegal operand
>
>
>
> Which is quite dangerous! If I didn't debug my code to find the origin
> of the Floating illegal operand warning, value_locate's output would be
> wrong.
>
>
>
> Someone else than me thinking of this as a bug?

NAN is neither greater than or less than any other finite number. For the purposes of VALUE_LOCATE(), there is no way to indicate "complete failure" other than the message you saw. I think the results of VALUE_LOCATE() are undefined, but this should be documented more explicitly in the reference documentation.

The lesson is: you can't use NAN's with VALUE_LOCATE().

Craig
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: random numbers with gamma distribution
Next Topic: new graphics legend function: problems with symbol fill color

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

Current Time: Fri Oct 10 11:06:16 PDT 2025

Total time taken to generate the page: 1.19599 seconds