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 #70557 is a reply to message #70556] Mon, 19 April 2010 12:18 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
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.
[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: Fri Oct 10 01:35:55 PDT 2025

Total time taken to generate the page: 0.48316 seconds