Rounds to truncated integer value.
#include <math.h>
double trunc (x)
double x;
float truncf (x)
float x;
long double truncl (x)
long double x;
_Decimal32 truncd32(x)
_Decimal32 x;
_Decimal64 truncd64(x)
_Decimal64 x;
_Decimal128 truncd128(x)
_Decimal128 x;
The trunc, truncf, truncl, truncd32, truncd64, and truncd128 subroutines round the x parameter to the integer value, in floating format, nearest to but no larger in magnitude than the x parameter.
Item | Description |
---|---|
x | Specifies the value to be rounded. |
Upon successful completion, the trunc, truncf, truncl, truncd32, truncd64, and truncd128 subroutines return the truncated integer value.
If x is NaN, a NaN is returned.
If x is ±0 or ±Inf, x is returned.