trunc

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)(C99)(C99)
Exponential functions
(C99)
(C99)
(C99)
(C99)
Power functions
(C99)
(C99)
Trigonometric and hyperbolic functions
(C99)
(C99)
(C99)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Nearest integer floating point operations
(C99)(C99)(C99)
trunc
(C99)
(C99)
(C99)(C99)(C99)
Floating point manipulation functions
(C99)(C99)
(C99)
(C99)
Classification
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)
Macro constants
 
Defined in header <math.h>
float       truncf( float arg );
(since C99)
double      trunc( double arg );
(since C99)
long double truncl( long double arg );
(since C99)

Computes nearest integer not greater in magnitude than arg.

Contents

[edit] Parameters

arg - floating point value

[edit] Return value

Nearest integer not greater in magnitude than arg.

[edit] Notes

The integer value can be always represented by the given floating point type.

[edit] See also

nearest integer not greater than the given value
(function)
nearest integer not less than the given value
(function)
(C99)(C99)(C99)
nearest integer, rounding away from zero in halfway cases
(function)
C++ documentation for trunc