NV5 GEOSPATIAL SOFTWARE
>  Docs Center  >  Libraries  >  ASTROLIB  >  NINT

NINT

NINT

## Purpose

Nearest integer function.

## Explanation

NINT() is similar to the intrinsic ROUND function, with the following
two differences:
(1) if no absolute value exceeds 32767, then the array is returned as
as a type INTEGER instead of LONG
(2) NINT will work on strings, e.g. print,nint(['3.4','-0.9']) will
give [3,-1], whereas ROUND() gives an error message

## Calling Sequence

result = nint( x, [ /LONG] )

## Input

X - An IDL variable, scalar or vector, usually floating or double
Unless the LONG keyword is set, X must be between -32767.5 and
32767.5 to avoid integer overflow

## Output

RESULT - Nearest integer to X

## Optional Keyword Input

LONG - If this keyword is set and non-zero, then the result of NINT
is of type LONG. Otherwise, the result is of type LONG if
any absolute values exceed 32767, and type INTEGER if all
all absolute values are less than 32767.

## Example

If X = [-0.9,-0.1,0.1,0.9] then NINT(X) = [-1,0,0,1]

None:

## Revision History

Written W. Landsman January 1989