]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/lrint.3
trunc.3: Make the description a little clearer
[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.\"
93015253 5.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
c13182ef 14.\"
fea681da
MK
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
c13182ef 22.\"
fea681da
MK
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 25.\" %%%LICENSE_END
fea681da 26.\"
4b8c67d9 27.TH LRINT 3 2017-09-15 "" "Linux Programmer's Manual"
fea681da
MK
28.SH NAME
29lrint, lrintf, lrintl, llrint, llrintf, llrintl \- round to nearest integer
30.SH SYNOPSIS
31.nf
32.B #include <math.h>
68e4db0a 33.PP
fea681da 34.BI "long int lrint(double " x );
fea681da 35.BI "long int lrintf(float " x );
fea681da 36.BI "long int lrintl(long double " x );
68e4db0a 37.PP
fea681da 38.BI "long long int llrint(double " x );
fea681da 39.BI "long long int llrintf(float " x );
fea681da
MK
40.BI "long long int llrintl(long double " x );
41.fi
68e4db0a 42.PP
cc4615cc 43Link with \fI\-lm\fP.
68e4db0a 44.PP
cc4615cc
MK
45.in -4n
46Feature Test Macro Requirements for glibc (see
47.BR feature_test_macros (7)):
48.in
68e4db0a 49.PP
cc4615cc
MK
50.ad l
51All functions shown above:
f1f0e4ed 52.RS 4
e464f054 53_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
f1f0e4ed
MK
54.RE
55.ad
fea681da
MK
56.SH DESCRIPTION
57These functions round their argument to the nearest integer value,
bf8e66b1
MK
58using the current rounding direction (see
59.BR fesetround (3)).
847e0d88 60.PP
6f9ea778
MK
61Note that unlike the
62.BR rint (3)
63family of functions,
64the return type of these functions differs from
bf8e66b1 65that of their arguments.
47297adb 66.SH RETURN VALUE
bf8e66b1 67These functions return the rounded integer value.
847e0d88 68.PP
bf8e66b1
MK
69If
70.I x
71is a NaN or an infinity,
72or the rounded value is too large to be stored in a
73.I long
74.RI ( "long long"
75in the case of the
76.B ll*
3f947a92 77functions),
efe294cb 78then a domain error occurs, and the return value is unspecified.
bf8e66b1 79.\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
fea681da 80.SH ERRORS
bf8e66b1
MK
81See
82.BR math_error (7)
83for information on how to determine whether an error has occurred
84when calling these functions.
85.PP
86The following errors can occur:
fea681da 87.TP
bf8e66b1
MK
88Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
89.\" .I errno
90.\" is set to
91.\" .BR EDOM .
92An invalid floating-point exception
93.RB ( FE_INVALID )
94is raised.
95.PP
96These functions do not set
97.IR errno .
98.\" FIXME . Is it intentional that these functions do not set errno?
99.\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6798
f0d7ce1d
MK
100.SH VERSIONS
101These functions first appeared in glibc in version 2.1.
5399a562 102.SH ATTRIBUTES
b51ab590
PH
103For an explanation of the terms used in this section, see
104.BR attributes (7).
105.TS
106allbox;
107lbw30 lb lb
108l l l.
109Interface Attribute Value
110T{
5399a562
PH
111.BR lrint (),
112.BR lrintf (),
113.BR lrintl (),
b51ab590 114.br
5399a562
PH
115.BR llrint (),
116.BR llrintf (),
5399a562 117.BR llrintl ()
b51ab590
PH
118T} Thread safety MT-Safe
119.TE
47297adb 120.SH CONFORMING TO
9a74e018 121C99, POSIX.1-2001, POSIX.1-2008.
47297adb 122.SH SEE ALSO
fea681da
MK
123.BR ceil (3),
124.BR floor (3),
125.BR lround (3),
126.BR nearbyint (3),
127.BR rint (3),
128.BR round (3)