C examples for math.h:llrint
function
<cmath> <ctgmath> <math.h>
Rounds x to an integral value, using the rounding direction specified by fegetround, and returns it as a value of type long long int.
long long int llrint (double x); long long int llrintf (float x); long long int llrintl (long double x); long long int llrint (float x); long long int llrint (long double x); long long int llrint (T x);
Parameter | Description |
---|---|
x | Value to round. |
The value of x rounded to a nearby integral, casted to a value of type long long int.
#include <stdio.h> #include <fenv.h> #include <math.h> int main ()//from w w w .j av a 2 s .c o m { printf ( "%lld\n", llrint(2.1) ); printf ( "%lld\n", llrint(3.9) ); printf ( "%lld\n", llrint(-2.1) ); printf ( "%lld\n", llrint(-3.9) ); return 0; }