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

Home » Public Forums » archive » Re: Comparison operators and floating-point errors
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: Comparison operators and floating-point errors [message #70556 is a reply to message #70554] Mon, 19 April 2010 13:36 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Apr 19, 3:18 pm, pp <pp.pente...@gmail.com> wrote:
> On Apr 19, 3:31 pm, Ed Hyer <ejh...@gmail.com> wrote:
>
>
>
>> IDL> nan=1/0.0
>> % Program caused arithmetic error: Floating divide by 0
>> IDL> print, -0.1 > nan
>>           Inf
>> IDL> print, -0.1 < nan
>>     -0.100000
>> IDL> print, 1 gt nan
>>    0
>> IDL> print, 1 lt nan
>>    1
>
>> I thought the rule was "Any calculation involving a NaN will produce
>> NaN."
>> Has it been this way since the dawn of time? I'm sure it has.
>
>> I have found a few uses for NaN in IDL over the years, and now I have
>> to come up with new ones.
>
>> For instance (the one that led me to track this down), I use NaN to
>> exclude areas from contour plots. There are other ways, but none quite
>> as simple and flexible.
>
> This all looks right to me, for one thing because there are no NaNs
> around. The variable you called nan is infinity, no NaN.


Right. Try setting NAN=0.0/0.0 or NAN=!values.f_nan.

Craig
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Comparison operators and floating-point errors
Next Topic: Re: Declaring large vectors in IDL

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

Current Time: Thu Oct 09 07:18:21 PDT 2025

Total time taken to generate the page: 0.31922 seconds