C examples for math.h:llround
function
<cmath> <ctgmath> <math.h>
Returns the integer value that is nearest in value to x, with halfway cases rounded away from zero.
The rounded value is returned as a value of type long long int.
long long int llround (double x); long long int llroundf (float x); long long int llroundl (long double x); long long int llround (float x); long long int llround (long double x); long long int llround (T x);
Parameter | Description |
---|---|
x | Value to round. |
The value of x rounded to the nearest integral, casted to a value of type long long int.
#include <stdio.h> #include <math.h> /* lround */ int main ()//from ww w . jav a 2s . co m { printf ( "%lld\n", llround(2.1) ); printf ( "%lld\n", llround(3.9) ); printf ( "%lld\n", llround(-2.1) ); printf ( "%lld\n", llround(-3.9) ); return 0; }