Rounds to the nearest integral value.
#include <math.h> float rintf (x) float x; long double rintl (x) long double x; double rint (x) double x;
The rintf, rintl, and rint subroutines return the integral value (represented as a double) nearest x in the direction of the current rounding mode. The current rounding mode is implementation-defined.
The rintf, rintl, and rint subroutines differ from the nearbyint, nearbyintf, and nearbyintl subroutines only in that they may raise the inexact floating-point exception if the result differs in value from the argument.
An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
x | Specifies the value to be rounded. |
Upon successful completion, the rintf, rintl, and rint subroutines return the integer (represented as a double precision number) nearest x in the direction of the current rounding mode.
If x is NaN, a NaN is returned.
If x is ±0 or ±Inf, x is returned.
If the correct value would cause overflow, a range error occurs the rintf, rintl, and rint subroutines return the value of the macro ±HUGE_VALF and ±HUGE_VALL (with the same sign as x), respectively.
abs Subroutine, floor, floorl, ceil, ceill, nearest, trunc, rint, itrunc, uitrunc, fmod, fmodl, fabs, or fabsl Subroutine, feclearexcept Subroutine, fetestexcept Subroutine, class, _class, finite, isnan, or unordered Subroutines, and lldiv Subroutine in AIX 5L Version 5.2 Technical Reference: Base Operating System and Extensions Volume 1.
math.h in AIX 5L Version 5.2 Files Reference.