share/mk/: build-html: Don't build mbind.2 and set_mempolicy.2
[man-pages.git] / man3 / trunc.3
blobbb8758fb156549660c7c20127614c3c6ef93814d
1 '\" t
2 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH trunc 3 (date) "Linux man-pages (unreleased)"
7 .SH NAME
8 trunc, truncf, truncl \- round to integer, toward zero
9 .SH LIBRARY
10 Math library
11 .RI ( libm ", " \-lm )
12 .SH SYNOPSIS
13 .nf
14 .B #include <math.h>
16 .BI "double trunc(double " x );
17 .BI "float truncf(float " x );
18 .BI "long double truncl(long double " x );
19 .fi
21 .RS -4
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
24 .RE
26 .BR trunc (),
27 .BR truncf (),
28 .BR truncl ():
29 .nf
30     _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
31 .fi
32 .SH DESCRIPTION
33 These functions round
34 .I x
35 to the nearest integer value that is not larger in magnitude than
36 .IR x .
37 .SH RETURN VALUE
38 These functions return the rounded integer value, in floating format.
41 .I x
42 is integral, infinite, or NaN,
43 .I x
44 itself is returned.
45 .SH ERRORS
46 No errors occur.
47 .SH ATTRIBUTES
48 For an explanation of the terms used in this section, see
49 .BR attributes (7).
50 .TS
51 allbox;
52 lbx lb lb
53 l l l.
54 Interface       Attribute       Value
56 .na
57 .nh
58 .BR trunc (),
59 .BR truncf (),
60 .BR truncl ()
61 T}      Thread safety   MT-Safe
62 .TE
63 .SH STANDARDS
64 C11, POSIX.1-2008.
65 .SH HISTORY
66 glibc 2.1.
67 C99, POSIX.1-2001.
68 .SH NOTES
69 The integral value returned by these functions may be too large
70 to store in an integer type
71 .RI ( int ,
72 .IR long ,
73 etc.).
74 To avoid an overflow, which will produce undefined results,
75 an application should perform a range check on the returned value
76 before assigning it to an integer type.
77 .SH SEE ALSO
78 .BR ceil (3),
79 .BR floor (3),
80 .BR lrint (3),
81 .BR nearbyint (3),
82 .BR rint (3),
83 .BR round (3)