trunc(), truncf(), truncl() — Truncate an integer value
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
C99 |
both | z/OS V1R5 |
Format
#define _ISOC99_SOURCE
#include <math.h>
double trunc(double x);
float truncf(float x);
long double Truncl(long double x);
C++
TR1 C99
#define _TR1_C99
#include <math.h>
float trunc(float x);
long double trunc(long double x);
General description
The trunc functions
round x to the integer value, in floating-point
format, nearest to but no larger in magnitude than x.
Note: The
following table shows the viable formats for these functions. See IEEE binary floating-point for more information about IEEE
Binary Floating-Point.
Function | Hex | IEEE |
---|---|---|
trunc | X | X |
truncf | X | X |
truncl | X | X |
Returned value
The trunc functions return the truncated integer value of x.