1TRUNC(3)                   Linux Programmer's Manual                  TRUNC(3)
2
3
4

NAME

6       trunc, truncf, truncl - round to integer, towards zero
7

SYNOPSIS

9       #include <math.h>
10
11       double trunc(double x);
12       float truncf(float x);
13       long double truncl(long double x);
14
15       Link with -lm.
16
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       trunc(), truncf(), truncl(): _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or
20       cc -std=c99
21

DESCRIPTION

23       These functions round x to the nearest integer not larger  in  absolute
24       value.
25

RETURN VALUE

27       These functions return the rounded integer value.
28
29       If x is integral, infinite, or NaN, x itself is returned.
30

ERRORS

32       No errors occur.
33

VERSIONS

35       These functions first appeared in glibc in version 2.1.
36

CONFORMING TO

38       C99, POSIX.1-2001.
39

NOTES

41       The  integral  value  returned  by  these functions may be too large to
42       store in an integer type (int, long,  etc.).   To  avoid  an  overflow,
43       which  will  produce undefined results, an application should perform a
44       range check on the returned value before assigning  it  to  an  integer
45       type.
46

SEE ALSO

48       ceil(3), floor(3), lrint(3), nearbyint(3), rint(3), round(3)
49

COLOPHON

51       This  page  is  part of release 3.22 of the Linux man-pages project.  A
52       description of the project, and information about reporting  bugs,  can
53       be found at http://www.kernel.org/doc/man-pages/.
54
55
56
57                                  2008-08-11                          TRUNC(3)
Impressum