Name
trunc, truncf, truncl
- round to integer, towards zero
Library
libm.lib
Synopsis
|
long double
truncl (long double x);
|
Return values
x
is integral, infinite or
NaN
,
x
itself is returned.
Detailed description
The
trunc,
truncf,
and
truncl
functions return the nearest integral value with magnitude less than
or equal to
| x |.
They are equivalent to
rint,
rintf,
and
rintl,
respectively, in the
FE_TOWARDZERO
rounding mode.
Examples
#include <math.h>
int main( )
{
double inp = 1048580.625;
double y;
y = trunc( inp );
printf( "trunc( %f) = %f\n", inp, y );
y = truncf( inp);
printf( "truncf( %f) = %f\n", inp, y );
y = truncl( inp);
printf( "truncl( %f) = %f\n\n", inp, y );
}
Output
trunc ( 1048580.625 ) = 1048580.000000
truncf( 1048580.625 ) = 1048580.000000
truncl( 1048580.625 ) = 1048580.000000
See also
ceil,
fegetround,
floor,
math,
nextafter,
rint,
round
Feedback
For additional information or queries on this page send feedback
© 2005-2007 Nokia
|
|