View Full Version : NINT behavior

05-26-2011, 01:13 PM
This surprised me. Is this expected or is this a bug?

x = 1/0.
nx = NINT(x, /LONG)
INFO, nx
; NX LONG = -2147483648

Notice you get a different result when you don't ask for LONG.

05-26-2011, 02:06 PM
From the documentation:

; NINT returns incorrect results when the input is out of
; the range of integers.
PRINT, NINT(200000.1) ; PV-WAVE prints: 3392

I see this as the same case. A NaN is, by definition, out of the range of integers, so NINT returns garbage.