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

Home » Public Forums » archive » Re: Incorrect behavior of /NAN
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: Incorrect behavior of /NAN [message #30027 is a reply to message #30025] Thu, 04 April 2002 09:32 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Kenneth Bowman <k-bowman@null.tamu.edu> writes:
> I tried to incite some interest in this last week, but had no takers,
> so I'll try again. ;-)
>
> I believe that the behavior of the TOTAL function is incorrect in
> the case where all of the data are NaN and the /NAN keyword is set.
>
> Here are several possible cases:
>
> IDL> a = !values.f_nan
> IDL> print, total([a, 1.0])
> NaN
> IDL> print, total([a, 1.0], /nan)
> 1.00000
> IDL> print, total([a, a])
> NaN
> IDL> print, total([a, a], /nan)
> 0.00000
>
> I believe that the last case is incorrect.
>
> The documentation for /NAN says "Elements with the value NaN are treated
> as missing data." In the last case there are no valid data, so how can
> their sum be zero?

Hi Ken--

If all the data are missing, how can the sum be NaN? Neither a return
value of 0, nor a return value of NaN, seems to be appropriate to
me. This appears to be an undefined case.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Need help identifying left most zero bit
Next Topic: Interfacing the functions

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

Current Time: Fri Oct 10 17:38:35 PDT 2025

Total time taken to generate the page: 1.12040 seconds