rint - round-to-nearest integral value
#include <math.h> double rint(double x);
The rint() function returns the integral value (represented as a double) nearest x in the direction of the current rounding mode. The current rounding mode is implementation-dependent.If the current rounding mode rounds toward negative infinity, then rint() is identical to floor(). If the current rounding mode rounds toward positive infinity, then rint() is identical to ceil().
Upon successful completion, the rint() function returns the integer (represented as a double precision number) nearest x in the direction of the current rounding mode.When x is ±Inf, rint() returns x.
If the value of x is NaN, NaN is returned and errno may be set to [EDOM].
The rint() function may fail if:
- [EDOM]
- The x argument is NaN.
None.
None.
None.
abs(), isnan(), <math.h>.