Re: Integer rounding of NaN [message #58109] |
Tue, 15 January 2008 06:33 |
lecacheux.alain
Messages: 325 Registered: January 2008
|
Senior Member |
|
|
I agree. I simply forgot to read the accompagnying error message:
Finite function is TRUE, but one has to catch the arithmetic error !
IDL> print,finite(round(!values.f_nan))
1
Program caused arithmetic error: Floating illegal operand
|
|
|
Re: Integer rounding of NaN [message #58110 is a reply to message #58109] |
Tue, 15 January 2008 05:56  |
Brian Larsen
Messages: 270 Registered: June 2006
|
Senior Member |
|
|
> IDL> print, float (round (!Values.F_NAN))
> -2.14748e+009
You should not expect this to work... as !Values.F_NAN is literally
not a number and the build in idl routines are notorious for not
doing any checking of their own for NaN and Inf. One is normally best
off making sure all the numbers are good before doing round,
r_correlate, sort, and many others.
Cheers,
Brian
------------------------------------------------------------ --------------
Brian Larsen
Boston University
Center for Space Physics
|
|
|