The NINT and ANINT functions round upwards if the fractional
part of the argument is 0.5 or more, whereas INT and AINT always
round towards zero. Thus:
INT(+3.5) = 3 NINT(+3.5) = 4
INT(-3.5) = -3 NINT(-3.5) = -4
The fractional part of a floating point number, X, can easily be
found either by:
X - AINT(X)
or
MOD(X, 1.0)
In either case, if X is negative the result will also be negative. The
ABS function can always be used to alter the sign if required.
The MOD function has other uses. For example it can find the day
of the week from an absolute day count such as Modified Julian
Date (MJD):
MOD(MJD,7)
has a value between 0 and 6 for days from Wednesday to Tuesday.
Similarly if you use the ATAN2 function but want the result to lie
in the range 0 to (rather than to ) then, assuming the
value of TWOPI is suitably defined, the required expression is:
MOD(ATAN2(X,Y) + TWOPI, TWOPI)