]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/trunc.3
pthread_kill_other_threads_np.3: grfix
[thirdparty/man-pages.git] / man3 / trunc.3
CommitLineData
fea681da
MK
1.\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
c13182ef 11.\"
fea681da
MK
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
f0d7ce1d 23.TH TRUNC 3 2008-08-11 "" "Linux Programmer's Manual"
fea681da
MK
24.SH NAME
25trunc, truncf, truncl \- round to integer, towards zero
26.SH SYNOPSIS
27.nf
28.B #include <math.h>
29.sp
30.BI "double trunc(double " x );
31.br
32.BI "float truncf(float " x );
33.br
34.BI "long double truncl(long double " x );
35.fi
36.sp
cc4615cc
MK
37Link with \fI\-lm\fP.
38.sp
39.in -4n
40Feature Test Macro Requirements for glibc (see
41.BR feature_test_macros (7)):
42.in
43.sp
44.ad l
45.BR trunc (),
46.BR truncf (),
47.BR truncl ():
5161d9e0 48.RS 4
d6585dbe
MK
49_XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
50_POSIX_C_SOURCE\ >=\ 200112L;
5161d9e0
MK
51.br
52or
cc4615cc 53.I cc\ -std=c99
5161d9e0
MK
54.RE
55.ad
fea681da
MK
56.SH DESCRIPTION
57These functions round \fIx\fP to the nearest integer
58not larger in absolute value.
59.SH "RETURN VALUE"
f1ab30a7
MK
60These functions return the rounded integer value.
61
62If \fIx\fP is integral, infinite, or NaN, \fIx\fP itself is returned.
fea681da 63.SH ERRORS
f1ab30a7 64No errors occur.
f0d7ce1d
MK
65.SH VERSIONS
66These functions first appeared in glibc in version 2.1.
fea681da 67.SH "CONFORMING TO"
f1ab30a7
MK
68C99, POSIX.1-2001.
69.SH NOTES
70The integral value returned by these functions may be too large
71to store in an integer type
72.RI ( int ,
73.IR long ,
74etc.).
75To avoid an overflow, which will produce undefined results,
76an application should perform a range check on the returned value
77before assigning it to an integer type.
fea681da
MK
78.SH "SEE ALSO"
79.BR ceil (3),
80.BR floor (3),
81.BR lrint (3),
82.BR nearbyint (3),
83.BR rint (3),
84.BR round (3)