Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

llrint, llrintf, llrintl - round to nearest integer value (long long int)

&pagelevel(4)&pagelevel

Syntax

#include <math.h>

long long int llrint(double x);

long long int llrintf (float x);

long long int llrintl (long double x);

Description  The functions return the integer value (displayed as a number of type long long int)

nearest to x.

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, llrint() is
identical to ceil(). If the currently set rounding mode rounds infinitely in the negative
direction, llrint() is identical to floor().

In this version the rounding mode is set to round infinitely in the positive direction.

Return val.

Integer

value (type long long int) nearest to x
if successful.

Undefined

for overflow or underflow. errno is set to ERANGE to indicate an error.

Errors

llrint(), llrintf(), llrintl() fails if:

ERANGE      The value is too large, and errno is set to indicate an error.

See also

abs(), ceil(), floor(), llround(), lrint(), lround(), rint(), round()