NEAREST intrinsic function
Standard: F77 F90 F95 F2003 F2008
Example Program
<Syntax>

NEAREST ( X, S )

X : Real;
S : Real, conformable with X, S≠0;

Result : Same type and kind as X.

<Semantics>

The value of the result is the nearest machine-representable number to X that is either less than X (if S<0) or greater than X (if S>0).

Like many intrinsic functions, this is elemental; if either (or both) of X and S is an array, the result will be an array with that shape, with the value being computed elementwise.

<Related>