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