Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
rint(3) OSS Library Calls Reference Manual
NAME
rint - Rounds floating-point numbers to nearest integral value
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRESRL
G-series native OSS processes: /G/system/sysnn/zcresrl
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 rint(
double x);
PARAMETERS
x Is the double-precision floating-point value to be rounded.
DESCRIPTION
The rint( ) 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 current rounding mode rounds in the direction of negative infinity, the rint( ) function is
identical to the floor( ) function. If the current rounding mode rounds in the direction of positive
infinity, the rint() function is identical to the ceil( ) function.
NOTES
The rint( ) function can be called only by native processes.
This function supports both IEEE Std 754-1985 floating-point and Tandem floating-point values.
IEEE values can include NaN and infinity, and the sign of 0.0 (zero) can be either positive or
negative. Refer to the fp_class(3) reference page for a description of IEEE value classes.
Guardian functions are available to convert between floating-point formats. Refer to the Guar-
dian Programmer’s Guide for a discussion of floating-point conversions.
Remember the following rules when using any special floating-point mode:
• Do not assume that functions such as printf( ) or tanh( ) behave correctly if you call
them after setting a nondefault operating mode (such as rounding toward zero). Unless a
function is documented as tolerating such modes, you should restore the default operat-
ing mode before calling the function.
• The exception bits of the floating-point status register stay set until they are explicitly
cleared.
RETURN VALUES
On successful completion, the rint( ) function returns the integral value (as a double) nearest the
value of the x parameter in the direction of the current rounding mode.
For IEEE floating-point values, when the value of x is positive or negative infinity, the rint( )
function returns the value of x. If the value of x is NaN, the function returns NaN.
ERRORS
No error values are returned. This function does not set errno.
RELATED INFORMATION
Functions: fp_class(3), isnan(3).
5−196 Hewlett-Packard Company 527187-017