]>
Commit | Line | Data |
---|---|---|
a1eaacb1 | 1 | '\" t |
fea681da | 2 | .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>. |
bf8e66b1 MK |
3 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
4 | .\" <mtk.manpages@gmail.com> | |
fea681da | 5 | .\" |
5fbde956 | 6 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da | 7 | .\" |
4c1c5274 | 8 | .TH lrint 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
9 | .SH NAME |
10 | lrint, lrintf, lrintl, llrint, llrintf, llrintl \- round to nearest integer | |
87811097 AC |
11 | .SH LIBRARY |
12 | Math library | |
8fc3b2cf | 13 | .RI ( libm ", " \-lm ) |
fea681da MK |
14 | .SH SYNOPSIS |
15 | .nf | |
16 | .B #include <math.h> | |
68e4db0a | 17 | .PP |
ae85f653 AC |
18 | .BI "long lrint(double " x ); |
19 | .BI "long lrintf(float " x ); | |
20 | .BI "long lrintl(long double " x ); | |
68e4db0a | 21 | .PP |
ae85f653 AC |
22 | .BI "long long llrint(double " x ); |
23 | .BI "long long llrintf(float " x ); | |
24 | .BI "long long llrintl(long double " x ); | |
fea681da | 25 | .fi |
68e4db0a | 26 | .PP |
d39ad78f | 27 | .RS -4 |
cc4615cc MK |
28 | Feature Test Macro Requirements for glibc (see |
29 | .BR feature_test_macros (7)): | |
d39ad78f | 30 | .RE |
68e4db0a | 31 | .PP |
cc4615cc | 32 | All functions shown above: |
9d2adbae | 33 | .nf |
5c10d2c5 | 34 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
9d2adbae | 35 | .fi |
fea681da MK |
36 | .SH DESCRIPTION |
37 | These functions round their argument to the nearest integer value, | |
bf8e66b1 MK |
38 | using the current rounding direction (see |
39 | .BR fesetround (3)). | |
847e0d88 | 40 | .PP |
6f9ea778 MK |
41 | Note that unlike the |
42 | .BR rint (3) | |
43 | family of functions, | |
44 | the return type of these functions differs from | |
bf8e66b1 | 45 | that of their arguments. |
47297adb | 46 | .SH RETURN VALUE |
bf8e66b1 | 47 | These functions return the rounded integer value. |
847e0d88 | 48 | .PP |
bf8e66b1 MK |
49 | If |
50 | .I x | |
51 | is a NaN or an infinity, | |
52 | or the rounded value is too large to be stored in a | |
53 | .I long | |
54 | .RI ( "long long" | |
55 | in the case of the | |
56 | .B ll* | |
3f947a92 | 57 | functions), |
efe294cb | 58 | then a domain error occurs, and the return value is unspecified. |
bf8e66b1 | 59 | .\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1) |
fea681da | 60 | .SH ERRORS |
bf8e66b1 MK |
61 | See |
62 | .BR math_error (7) | |
63 | for information on how to determine whether an error has occurred | |
64 | when calling these functions. | |
65 | .PP | |
66 | The following errors can occur: | |
fea681da | 67 | .TP |
bf8e66b1 MK |
68 | Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large |
69 | .\" .I errno | |
70 | .\" is set to | |
71 | .\" .BR EDOM . | |
72 | An invalid floating-point exception | |
73 | .RB ( FE_INVALID ) | |
74 | is raised. | |
75 | .PP | |
76 | These functions do not set | |
77 | .IR errno . | |
78 | .\" FIXME . Is it intentional that these functions do not set errno? | |
fd00f831 | 79 | .\" Bug raised: https://www.sourceware.org/bugzilla/show_bug.cgi?id=6798 |
5399a562 | 80 | .SH ATTRIBUTES |
b51ab590 PH |
81 | For an explanation of the terms used in this section, see |
82 | .BR attributes (7). | |
83 | .TS | |
84 | allbox; | |
c466875e | 85 | lbx lb lb |
b51ab590 PH |
86 | l l l. |
87 | Interface Attribute Value | |
88 | T{ | |
9e54434e BR |
89 | .na |
90 | .nh | |
5399a562 PH |
91 | .BR lrint (), |
92 | .BR lrintf (), | |
93 | .BR lrintl (), | |
94 | .BR llrint (), | |
95 | .BR llrintf (), | |
5399a562 | 96 | .BR llrintl () |
b51ab590 PH |
97 | T} Thread safety MT-Safe |
98 | .TE | |
c466875e | 99 | .sp 1 |
3113c7f3 | 100 | .SH STANDARDS |
4131356c AC |
101 | C11, POSIX.1-2008. |
102 | .SH HISTORY | |
103 | glibc 2.1. | |
104 | C99, POSIX.1-2001. | |
47297adb | 105 | .SH SEE ALSO |
fea681da MK |
106 | .BR ceil (3), |
107 | .BR floor (3), | |
108 | .BR lround (3), | |
109 | .BR nearbyint (3), | |
110 | .BR rint (3), | |
111 | .BR round (3) |