Previous: tanh, Up: Math


1.57 trunc, truncf–round to integer, towards zero

Synopsis

     #include <math.h>
     double trunc(double x);
     float truncf(float x);
     

Description
The trunc functions round their argument to the integer value, in floating format, nearest to but no larger in magnitude than the argument, regardless of the current rounding direction. (While the "inexact" floating-point exception behavior is unspecified by the C standard, the trunc functions are written so that "inexact" is not raised if the result does not equal the argument, which behavior is as recommended by IEEE 754 for its related functions.)


Returns
x truncated to an integral value.


Portability
ANSI C, POSIX