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

Home » Public Forums » archive » Re: the NaN effect :-|
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: the NaN effect :-| [message #54396 is a reply to message #54395] Tue, 12 June 2007 08:53 Go to previous messageGo to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
This probably have everything to do with the way that min() and max()
are written. They are probably quite clever (or like to think they
are :) ) and so I think that if you move the NaN around you will get
different answers just as with different numbers of NaN's.

I have never tested to see if/how much slower they are if you just
always use the /nan keyword. Might me interesting...

Brian

------------------------------------------------------------ ---------------------
Brian Larsen
Boston University
Center for Space Physics



On Jun 12, 11:33 am, metachronist <rkombi...@gmail.com> wrote:
> This stumps me.. We had some discussions on NaN's earlier, but mostly
> wrt 'TOTAL'
> Lets say,
> IDL>a=[6.2,12.5,14.1,0.,22,!values.f_nan]
> IDL> print,max(a)
> 22.0000
> IDL> print,min(a)
> 0.00000
>
> ; Now I increase number of NaN's in the array :D
>
> IDL> a=[6.2,12.5,14.1,0.,!values.f_nan,22,!values.f_nan]
> IDL> print,max(a)
> 22.0000
> IDL> print,min(a)
> 0.00000
>
> ; go on, repeat this (it is 00:23 where I am @, so CARPE NOCTEM! ) :-P
>
> IDL> a=[!values.f_nan,6.2,12.5,14.1,0.,!values.f_nan,22,!values.f _nan]
> IDL> print,min(a)
> NaN
> IDL> print,max(a)
> NaN
> ============================================
> Same goes for MIN also. ??!!
>
> IDL's docu says:
> <snip from IDL ref guide: Page 1269/4090>
> If the MAX function is run on an array containing NaN values and the
> NAN keyword is not set, an invalid result will occur.
> </snip>
> The same is said for MIN also.
>
> So the result (OPS with MIN/MAX) is directly proportional to the
> number of NaN's we eat? er, add to the array? :P
>
> So what is right and what is wrong? Enlighten, please.
> /metachronist
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: defining a data structure
Next Topic: Dealing with Large data arrays, reducing memory and ASSOC

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

Current Time: Wed Oct 08 17:43:30 PDT 2025

Total time taken to generate the page: 0.00557 seconds