1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH TRUNC 3 2021-03-22 "Linux man-pages (unreleased)"
7 trunc, truncf, truncl \- round to integer, toward zero
10 .RI ( libm ", " \-lm )
15 .BI "double trunc(double " x );
16 .BI "float truncf(float " x );
17 .BI "long double truncl(long double " x );
21 Feature Test Macro Requirements for glibc (see
22 .BR feature_test_macros (7)):
29 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
34 to the nearest integer value that is not larger in magnitude than
37 These functions return the rounded integer value, in floating format.
41 is integral, infinite, or NaN,
47 These functions first appeared in glibc in version 2.1.
49 For an explanation of the terms used in this section, see
57 Interface Attribute Value
62 T} Thread safety MT-Safe
68 C99, POSIX.1-2001, POSIX.1-2008.
70 The integral value returned by these functions may be too large
71 to store in an integer type
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.