Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

rint(3) Guardian Native C Library Calls Reference Manual
NAME
rint - Rounds oating-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 native Guardian processes: $SYSTEM.ZDLLnnn.ZCREDLL
H-series OSS processes: /G/system/zdllnnn/zcredll
SYNOPSIS
#include <math.h>
double rint(
double x);
PARAMETERS
x Is the double-precision oating-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 innity, the rint() function is
identical to the oor( ) function. If the current rounding mode rounds in the direction of positive
innity, 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 oating-point and Tandem oating-point values.
IEEE values can include NaN and innity, 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 oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-point conversions.
Remember the following rules when using any special oating-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 oating-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 oating-point values, when the value of x is positive or negative innity, 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).
588 Hewlett-Packard Company 527192-007