]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>. |
2 | .\" | |
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. | |
6 | .\" | |
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. | |
11 | .\" | |
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 | |
18 | .\" professionally. | |
19 | .\" | |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
22 | .\" | |
23 | .TH RINT 3 2001-05-31 "" "Linux Programmer's Manual" | |
24 | .SH NAME | |
25 | nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl \- round to nearest integer | |
26 | .SH SYNOPSIS | |
27 | .nf | |
28 | .B #include <math.h> | |
29 | .sp | |
30 | .BI "double nearbyint(double " x ); | |
31 | .br | |
32 | .BI "float nearbyintf(float " x ); | |
33 | .br | |
34 | .BI "long double nearbyintl(long double " x ); | |
35 | .sp | |
36 | .BI "double rint(double " x ); | |
37 | .br | |
38 | .BI "float rintf(float " x ); | |
39 | .br | |
40 | .BI "long double rintl(long double " x ); | |
41 | .fi | |
42 | .sp | |
43 | Link with \-lm. | |
44 | .SH DESCRIPTION | |
45 | The | |
e511ffb6 | 46 | .BR nearbyint () |
fea681da MK |
47 | functions round their argument to an integer value in floating point |
48 | format, using the current rounding direction and without raising the | |
49 | .I inexact | |
50 | exception. | |
51 | .LP | |
52 | The | |
e511ffb6 | 53 | .BR rint () |
fea681da MK |
54 | functions do the same, but will raise the |
55 | .I inexact | |
56 | exception when the result differs in value from the argument. | |
57 | .SH "RETURN VALUE" | |
58 | The rounded integer value. If \fIx\fP is integral or infinite, | |
59 | \fIx\fP itself is returned. | |
60 | .SH ERRORS | |
61 | No errors other than EDOM and ERANGE can occur. | |
62 | If \fIx\fP is NaN, then NaN is returned and | |
63 | .I errno | |
64 | may be set to EDOM. | |
65 | .SH NOTES | |
68e1685c | 66 | SUSv2 and POSIX.1-2001 contain text about overflow (which might set |
fea681da MK |
67 | .I errno |
68 | to ERANGE, or raise an exception). | |
69 | In practice, the result cannot overflow on any current machine, | |
70 | so this error-handling stuff is just nonsense. | |
71 | (More precisely, overflow can happen only when the maximum value | |
72 | of the exponent is smaller than the number of mantissa bits. | |
73 | For the IEEE-754 standard 32-bit and 64-bit floating point numbers | |
74 | the maximum value of the exponent is 128 (resp. 1024), and the number | |
75 | of mantissa bits is 24 (resp. 53).) | |
76 | .SH "CONFORMING TO" | |
68e1685c | 77 | C99. |
fea681da MK |
78 | .SH "SEE ALSO" |
79 | .BR ceil (3), | |
80 | .BR floor (3), | |
81 | .BR lrint (3), | |
82 | .BR nearbyint (3), | |
83 | .BR round (3), | |
84 | .BR trunc (3) |