[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: where() and IEEE NaN
- Subject: Re: where() and IEEE NaN
- From: Vincenzo Andretta <andretta(at)hector.gsfc.nasa.gov>
- Date: Sat, 06 Nov 1999 13:15:44 -0500
- Newsgroups: comp.lang.idl-pvwave
- Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA
- References: <7vv1j3$6ro$1@ra.nrl.navy.mil>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:17144
Try:
WHERE(FINITE(array,/NaN) eq 1)
Example:
IDL> array=[1.0,!VALUES.F_Infinity,-!VALUES.F_Infinity,!VALUES.F_NaN]
IDL> print,where(finite(array) eq 0)
1 2 3
IDL> print,where(finite(array,/NaN) eq 1)
3
IDL> print,where(finite(array,/infinity) eq 1)
1 2
Note that IDL seems to be able to deal with "infinities", at least to some
extent:
IDL> print,min(array),max(array)
-Inf Inf
% Program caused arithmetic error: Floating illegal operand
IDL> print,1./array
1.00000 0.00000 -0.00000 NaN
I wouldn't rely on this behaviour, but it is conceivable one might want
to know where NaN values are, while ignoring infinities.
Vincenzo Andretta
CUA,NASA/GSFC - Laboratory for Astronomy and Solar Physics
Greenbelt, MD 20771 - USA
P.S:
IDL> help,/structure,!version
** Structure !VERSION, 5 tags, length=80:
ARCH STRING 'alpha'
OS STRING 'OSF'
OS_FAMILY STRING 'unix'
RELEASE STRING '5.2'
BUILD_DATE STRING 'Oct 30 1998'