[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: where() and IEEE NaN


  WHERE(FINITE(array,/NaN) eq 1)


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)
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 

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

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'