[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (Mis)use of the is_nan_or_na() mapper function
From: |
David Bateman |
Subject: |
Re: (Mis)use of the is_nan_or_na() mapper function |
Date: |
Mon, 11 Oct 2004 09:45:49 +0200 |
User-agent: |
Mutt/1.4.1i |
The function is_nan_or_na is a mapper function that directly calls
lo_ieee_is_NaN_or_NA. So if there is a problem its almost certainly
in the underlying library function.
For what it is worth I get
octave:1> p = 1:10; p(3) = NaN; p(5) = NA;
octave:2> isna(p) | isnan(p)
ans =
0 0 1 0 1 0 0 0 0 0
octave:3> is_nan_or_na(p)
ans =
0 0 1 0 1 0 0 0 0 0
So it defintely seems that lo_ieee_is_NaN_or_NA is broken on your
platform.. I suggest you report exact what platform you are running
on including compiler versions, etc and perhaps a workaround can be
included in lo-ieee.h within octave itself...
Regards
David
According to Paul Laub <address@hidden> (on 10/11/04):
> Dear all,
>
> Am I missing something or is there a problem with the function
> is_nan_or_na? I am interested in using it to identify missing
> data elements (variously marked NaN or NA -- I know, NA is
> preferable).
>
> It appears that is_nan_or_na() does not detect NAs as this
> transcript shows. I am using Octave 2.1.42 in Windows 2000.
>
> 184 >> which is_nan_or_na
> is_nan_or_na is a built-in mapper function
> 185 >> p = 1:10;
> 186 >> p(3) = NaN;
> 187 >> p(5) = NA;
> 188 >> isna(p) | isnan(p)
> ans =
>
> 0 0 1 0 1 0 0 0 0 0 # what I expect
>
> 189 >> is_nan_or_na(p)
> ans =
>
> 0 0 1 0 0 0 0 0 0 0 # not what I expect
>
> 190 >> is_nan_or_na(NaN)
> ans = 1
> 191 >> is_nan_or_na(NA) # well ...
> ans = 0
>
> The workaround is obvious; it is command 188 above. But what gives
> with is_nan_or_na()?
>
> Paul Laub
>
> P.S. A web search turned up this 2002 discussion issues.
>
> http://www.octave.org/mailing-lists/help-octave/2002/581
>
> What caught my eye is that in that exchange the function is
> named with different case, ie., is_NaN_or_NA. I know that
> Octave is case-sensitive.
>
> P.P.S. Having NA is a good idea but how is it implemented?
> How do you keep it separate from NaN and Inf and still use
> IEEE style floating point math? I notice that sprintf("%f", NA)
> returns "NaN".
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
--
David Bateman address@hidden
Motorola CRM +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax)
91193 Gif-Sur-Yvette FRANCE
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------