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 to nearest integer value

&pagelevel(4)&pagelevel

Syntax

#include <math.h>

double rint(double x);

float rintf(float x);

long double rintl(long double x); 

Description

The functions return the integer value (displayed as a floating point number) nearest to x.

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 returned value is rounded according to the currently set rounding mode of the computer. If the default mode is set to ’round-to-nearest’ and the difference between x and the rounded result is exactly 0.5, the next even integer is returned.

If the currently set rounding mode rounds infinitely in the positive direction, rint() is identical to ceil(). If the currently set rounding mode rounds infinitely in the negative direction, rint() is identical to floor(). In this version the rounding mode is set to positive infinity.

Return val.

Integer value

represented as a number of type double, float or long double.

Notes

In this version the rounding mode is set to positive infinity.

See also

abs(), ceil(), floor(), llrint(), llround(), lrint(), lround(), round().