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