Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
rint, rintf, rintl - Round off to nearest whole number
&pagelevel(4)&pagelevel
Definition | #include <math.h> double rint(double x); float rintf (float x); long double rintl (long double x); Each of the functions returns the whole number nearest to x, in floating point representation.
rint represents the result as a number of type double , rintf as a number of type float , and rintl as a number of type long double . The return value is rounded off in accordance with the rounding mode currently set for the system. If the rounding mode ‘round-to-nearest’ is set and if the difference between x and the rounded result is exactly 0.5, the next even whole number is returned. If the defined rounding mode rounds off in the direction of positive infinity, then rint is identical to ceil . If the defined rounding mode rounds off in the direction of negative infinity, then rint is identical to floor . In this version, the rounding mode is preset in the direction of positive infinity. |
Return val. | integer | represented as a number of type double , float or long double if successful. |
HUGE_VAL | in the event of an overflow, errno is set to ERANGE to indicate the error. |
Note See also | In this version, the rounding mode is preset in the direction of positive infinity. abs, ceil, floor, llrint, llround, lrint, lround, round |