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 #70552] Mon, 19 April 2010 15:23 Go to previous message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
"pp" <pp.penteado@gmail.com> wrote in message
news:54eb565d-1480-43e8-b202-1e938bebb5e6@n20g2000prh.google groups.com...
On Apr 19, 6:24 pm, Ed Hyer <ejh...@gmail.com> wrote:
> On Apr 19, 1:36 pm, Craig Markwardt <craig.markwa...@gmail.com> wrote:
>
>> Right. Try setting NAN=0.0/0.0 or NAN=!values.f_nan.
>
> OK, so for the purpose of masking an array with a binary mask, I had
> been using
>
> MASKED_DATA = DATA / FLOAT(MASK)
>
> and should instead use
>
> MASKED_DATA = (DATA * MASK) / FLOAT(MASK)
>
> in order to ensure that the masked values are all NaN.

> Or

> w=where(~mask,nw)
> if (nw gt 0) then masked_data[w]=!values.d_nan


Definitely good advice. You want people to understand your
code when they read it, and if you want nans, then explicitly
put in nans. There is no way a person can know what is
in your mask array, and know that you are NANing out values.


cheers,
bob
[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: Wed Oct 08 15:20:27 PDT 2025

Total time taken to generate the page: 0.00183 seconds