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 off to nearest whole number

&pagelevel(4)&pagelevel

Definition

#include <math.h>

long long int llrint(double x);

long long int llrintf (float x);

long long int llrintl (long double x);

Each of the functions returns the whole number nearest to x, represented as a number of
type long long int.

The return value is rounded off in accordance with the rounding mode currently set for the
system. If the rounding mode is ‘round-to-nearest’ and if the difference between x and the
rounded result is exactly 0.5, the nearest even number is returned.

If the rounding mode currently set rounds off in the direction of positive infinity, then llrint
is equivalent to ceil. If the defined rounding mode rounds off in the direction of negative
infinity, then llrint is equivalent 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 long long int
if successful.

undefined

in the event of an overflow or underflow, 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, llround, lrint, lround, rint, round