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

Home » Public Forums » archive » Re: manipulating structures
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: manipulating structures [message #53344 is a reply to message #53343] Mon, 09 April 2007 08:02 Go to previous messageGo to previous message
Kenneth Bowman is currently offline  Kenneth Bowman
Messages: 86
Registered: November 2006
Member
In article <Pine.LNX.4.64.0704082118360.6079@bifur.rmki.kfki.hu>,
FOLDY Lajos <foldy@rmki.kfki.hu> wrote:

> On Sun, 8 Apr 2007, Kenneth P. Bowman wrote:
>
>> The rules for IEEE arithmetic say that the result of any operation
>> involving a NaN is a NaN. That is not true in the case of TOTAL. If
>> you sum an array that is all NaNs, the result is zero.
>
> You are summing an empty array, if the /NaN keyword (= discard NaNs) was
> set. So, what is the sum of an empty array: 0 or Nan? :-)
>
> regards,
> lajos

How can the sum of no numbers be a number?

I know we went through this same philosophical argument before, but in the end
the /NAN keyword is there as a programming convenience. Zero is
a valid answer when there are good data in the array. It should not be a
valid answer when there are no good data in the array.

As I said, it renders the /NAN keyword useless to me. I don't want to
get a valid number back when there are no valid input data.

Instead of

tot = TOTAL(x, /NAN)

I must do

i = WHERE(FINITE(x), COUNT = count)
IF (COUNT EQ 0) THEN tot = !VALUES.F_NAN $
ELSE tot = TOTAL(x[i])

Ken
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: map_proj_init
Next Topic: Re: counting rows

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

Current Time: Thu Oct 09 20:26:39 PDT 2025

Total time taken to generate the page: 0.00472 seconds