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

Home » Public Forums » archive » n_elements and NaN
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
n_elements and NaN [message #74563] Tue, 25 January 2011 12:26 Go to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Just recognized some fun with NaN or more arguments against NaN.

n_elements haven't a NaN keyword


Reimar
Re: n_elements and NaN [message #74613 is a reply to message #74563] Thu, 27 January 2011 07:24 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Jan 26, 12:20 pm, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
> Am 26.01.2011 09:15, schrieb alx:
>
>> On 25 jan, 21:26, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
>>> Just recognized some fun with NaN or more arguments against NaN.
>
>>> n_elements haven't a NaN keyword
>
>>> Reimar
>
>> Why should it do ?
>> "N_elements(x)" is the old way for "(Size(x))[-1]" or "Size(x,/
>> N_ELEMENTS)".
>> What you want is "where(finite(x), COUNT=number_of_finite_elements,
>> NCOMP=number_of_nan)".
>> The two statements adress two different things: the x size and x
>> content.
>> alx.
>
> This is only a workaround. Until NaN is not completly supported we will
> always have risks to use it. Or having more complicated code as usually
> needed. If you for example expect only to have Long values you would
> never expect NaN numbers there and the data of type float.
>
> Reimar

I'm with alx on this - I would be very annoyed if n_elements looked at
the contents of what it's given rather than just the syntactic
structure (it would be *much* slower, for one thing!).

-Jeremy.
Re: n_elements and NaN [message #74632 is a reply to message #74563] Wed, 26 January 2011 09:20 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Am 26.01.2011 09:15, schrieb alx:
> On 25 jan, 21:26, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
>> Just recognized some fun with NaN or more arguments against NaN.
>>
>> n_elements haven't a NaN keyword
>>
>> Reimar
>
> Why should it do ?
> "N_elements(x)" is the old way for "(Size(x))[-1]" or "Size(x,/
> N_ELEMENTS)".
> What you want is "where(finite(x), COUNT=number_of_finite_elements,
> NCOMP=number_of_nan)".
> The two statements adress two different things: the x size and x
> content.
> alx.


This is only a workaround. Until NaN is not completly supported we will
always have risks to use it. Or having more complicated code as usually
needed. If you for example expect only to have Long values you would
never expect NaN numbers there and the data of type float.



Reimar
Re: n_elements and NaN [message #74648 is a reply to message #74563] Wed, 26 January 2011 00:15 Go to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 25 jan, 21:26, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
> Just recognized some fun with NaN or more arguments against NaN.
>
> n_elements haven't a NaN keyword
>
> Reimar

Why should it do ?
"N_elements(x)" is the old way for "(Size(x))[-1]" or "Size(x,/
N_ELEMENTS)".
What you want is "where(finite(x), COUNT=number_of_finite_elements,
NCOMP=number_of_nan)".
The two statements adress two different things: the x size and x
content.
alx.
Re: n_elements and NaN [message #74656 is a reply to message #74563] Tue, 25 January 2011 14:19 Go to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 25 Jan., 21:26, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
> Just recognized some fun with NaN or more arguments against NaN.
>
> n_elements haven't a NaN keyword
>
> Reimar

Yes,
a nan check for all routines would be wonderful...

Schade an sich

CR
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL books for beginners
Next Topic: Speed Improvement

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

Current Time: Wed Oct 08 13:44:10 PDT 2025

Total time taken to generate the page: 0.00708 seconds