]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/lrint.3
man*/: ffix (un-bracket tables)
[thirdparty/man-pages.git] / man3 / lrint.3
CommitLineData
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
10lrint, lrintf, lrintl, llrint, llrintf, llrintl \- round to nearest integer
87811097
AC
11.SH LIBRARY
12Math 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
28Feature Test Macro Requirements for glibc (see
29.BR feature_test_macros (7)):
d39ad78f 30.RE
68e4db0a 31.PP
cc4615cc 32All functions shown above:
9d2adbae 33.nf
5c10d2c5 34 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
9d2adbae 35.fi
fea681da
MK
36.SH DESCRIPTION
37These functions round their argument to the nearest integer value,
bf8e66b1
MK
38using the current rounding direction (see
39.BR fesetround (3)).
847e0d88 40.PP
6f9ea778
MK
41Note that unlike the
42.BR rint (3)
43family of functions,
44the return type of these functions differs from
bf8e66b1 45that of their arguments.
47297adb 46.SH RETURN VALUE
bf8e66b1 47These functions return the rounded integer value.
847e0d88 48.PP
bf8e66b1
MK
49If
50.I x
51is a NaN or an infinity,
52or the rounded value is too large to be stored in a
53.I long
54.RI ( "long long"
55in the case of the
56.B ll*
3f947a92 57functions),
efe294cb 58then 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
61See
62.BR math_error (7)
63for information on how to determine whether an error has occurred
64when calling these functions.
65.PP
66The following errors can occur:
fea681da 67.TP
bf8e66b1
MK
68Domain 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 .
72An invalid floating-point exception
73.RB ( FE_INVALID )
74is raised.
75.PP
76These 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
81For an explanation of the terms used in this section, see
82.BR attributes (7).
83.TS
84allbox;
c466875e 85lbx lb lb
b51ab590
PH
86l l l.
87Interface Attribute Value
88T{
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
97T} Thread safety MT-Safe
98.TE
c466875e 99.sp 1
3113c7f3 100.SH STANDARDS
4131356c
AC
101C11, POSIX.1-2008.
102.SH HISTORY
103glibc 2.1.
104C99, 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)