Everything

lround / lroundf / lroundl / llround / llroundf / llroundl


Rounds a floating-point number to the nearest integer.

[Format]

#include <math.h>

long int lround(double d);

long int lroundf(float d);

long int lroundl(long double d);

long long int llround (double d);

long long int llroundf(float d);

long long int llroundl(long double d);

[Parameters]

d Value to be rounded to an integer

[Return values]

Normal: d rounded to an integer

Abnormal: Range error: Returns an undetermined value.

[Remarks]

A range error may occur if the absolute value of d is too large.

When d is at the midpoint between two integers, the lround function group selects the integer farther from 0 regardless of the current rounding direction. The return value is unspecified when the rounded value is not in the range of the return value type.