Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
OSS Library Calls (n - r) nearbyint(3)
NAME
nearbyint - Rounds floating-point number to nearest integral value
LIBRARY
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcredll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycredll
SYNOPSIS
#include <math.h>
double nearbyint(
double x);
PARAMETERS
x Is the double value to be rounded.
DESCRIPTION
The nearbyint( ) function returns the integral value (as a double) nearest the value of the x
parameter in the direction of the current rounding mode but does not raise the inexact floating-
point exception.
NOTES
This function is implemented only for the IEEE_float floating-point option. Applications using
this function cannot be compiled if the specified floating-point option is Tandem_float.
RETURN VALUES
On successful completion, the nearbyint( ) function returns the integral value (as a double)
nearest the value of the x parameter in the direction of the current rounding mode.
If the value of x is NaN, the function returns NaN.
If the value of x is positive or negative zero, the function returns positive or negative zero.
If the value of x is positive or negative infinity, the function returns the value of x.
If the correct value would cause overflow, the function returns HUGE_VAL (with the same sign
as x) and sets errno to [ERANGE].
ERRORS
If the following condition exists, the nearbyint( ) function sets errno to the corresponding value:
[ERANGE] The result would cause overflow.
RELATED INFORMATION
Functions: ceil(3), fabs(3), fegetround(3), fesetround(3), floor(3), fmod(3), lrint(3), llrint(3),
lround(3), llround(3), nearbyintf(3), nearbyintl(3), rint(3), round(3), trunc(3).
Files: math(4).
STANDARDS CONFORMANCE
This function conforms to the ISO/IEC 9899:1999 standard.
This function conforms to the IEEE Std 1003.1, 2004 Edition.
527187-017 Hewlett-Packard Company 5−5