Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
lrint, lrintf, lrintl - Round off to nearest whole number
&pagelevel(4)&pagelevel
Definition | #include <math.h> long int lrint(double x); long int lrintf (float x); long int lrintl (long double x); Each of the functions returns the whole number nearest to x, represented as a number of type 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 lrint is equivalent to ceil . If the defined rounding mode rounds off in the direction of negative infinity, then lrint 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 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, llrint, llround, lround, rint, round |