llround
Return the rounded value in long long int format based on the current rounding mode.
Interface Definition
C interface:
long long int llroundf(float x);
long long int llround(double x);
long long int llroundl(long double x);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of the input data. |
Input |
Return Value
The rounded value of x is returned. x ∈ (-inf, inf)
Dependency
C: "km.h"
Example
C interface:
// typical usage
printf("llround(0.0) = %lld\n", llround(0.0));
printf("llround(-0.0) = %lld\n", llround(-0.0));
printf("llround(1.0) = %lld\n", llround(1.0));
printf("llround(1.4) = %lld\n", llround(1.4));
printf("llround(1.5) = %lld\n", llround(1.5));
printf("llround(-3.0) = %lld\n", llround(-3.0));
printf("llround(-3.4) = %lld\n", llround(-3.4));
printf("llround(-3.5) = %lld\n", llround(-3.5));
result
/*
* llround(0.0) = 0
* llround(-0.0) = 0
* llround(1.0) = 1
* llround(1.4) = 1
* llround(1.5) = 2
* llround(-3.0) = -3
* llround(-3.4) = -3
* llround(-3.5) = -4
* */
Parent topic: Rounding Functions