1 .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .TH RINT 3 2007-07-26 "" "Linux Programmer's Manual"
25 nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl \- round to nearest integer
30 .BI "double nearbyint(double " x );
32 .BI "float nearbyintf(float " x );
34 .BI "long double nearbyintl(long double " x );
36 .BI "double rint(double " x );
38 .BI "float rintf(float " x );
40 .BI "long double rintl(long double " x );
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
54 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
60 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _ISOC99_SOURCE; or
66 functions round their argument to an integer value in floating point
67 format, using the current rounding direction and without raising the
73 functions do the same, but will raise the
75 exception when the result differs in value from the argument.
77 The rounded integer value.
78 If \fIx\fP is integral or infinite,
79 \fIx\fP itself is returned.
86 If \fIx\fP is NaN, then NaN is returned and
93 SUSv2 and POSIX.1-2001 contain text about overflow (which might set
97 or raise an exception).
98 In practice, the result cannot overflow on any current machine,
99 so this error-handling stuff is just nonsense.
100 (More precisely, overflow can happen only when the maximum value
101 of the exponent is smaller than the number of mantissa bits.
102 For the IEEE-754 standard 32-bit and 64-bit floating point numbers
103 the maximum value of the exponent is 128 (respectively, 1024), and the number
104 of mantissa bits is 24 (respectively, 53).)