2 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH trunc 3 (date) "Linux man-pages (unreleased)"
8 trunc, truncf, truncl \- round to integer, toward zero
11 .RI ( libm ", " \-lm )
16 .BI "double trunc(double " x );
17 .BI "float truncf(float " x );
18 .BI "long double truncl(long double " x );
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
30 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
35 to the nearest integer value that is not larger in magnitude than
38 These functions return the rounded integer value, in floating format.
42 is integral, infinite, or NaN,
48 For an explanation of the terms used in this section, see
54 Interface Attribute Value
61 T} Thread safety MT-Safe
69 The integral value returned by these functions may be too large
70 to store in an integer type
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.