NEARBYINT 3CW "09 March 2006" "mathcw-1.00"

Table of contents


NAME

nearbyintf, nearbyint, nearbyintl, nearbyintw, nearbyintq, nearbyintll, nearbyintdf, nearbyintd, nearbyintdl, nearbyintdll - floating-point rounding function using current rounding direction without raising inexact flag

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

extern float nearbyintf (float x);

extern double nearbyint (double x);

extern long double nearbyintl (long double x);

extern __float80 nearbyintw (__float80 x);

extern __float128 nearbyintq (__float128 x);

extern long_long_double nearbyintll (long_long_double x);

extern decimal_float nearbyintdf (decimal_float x);

extern decimal_double nearbyintd (decimal_double x);

extern decimal_long_double nearbyintdl (decimal_long_double x);

extern decimal_long_long_double nearbyintdll (decimal_long_long_double x);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Compute the whole number nearest x in the direction of the current IEEE 754 rounding mode, but without setting the inexact exception flag.

Caution: Depending on the argument size and precision, the result may be too large to store in a variable of some integer type, even though it is exactly representable as a floating-point value.

Caution: The requirement to avoid setting the inexact exception flag is costly in some implementations, including this one. Unless you really need that feature, use the functions in the rint() family instead: they produce the same results as those in the nearbyint() family, but may set the inexact exception flag (as do most floating-point operations).


RETURN VALUES

For finite nonzero arguments, the returned value is the requisite whole number. For Infinity, NaN, and zero arguments, the returned value is the argument.

ERRORS

None.

SEE ALSO

floor(3CW), llrint(3CW), llround(3CW), lrint(3CW), lround(3CW), modf(3CW), rint(3CW), round(3CW), trunc(3CW).