]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/lround.3
Many pages: Fix style issues reported by `make lint-groff`
[thirdparty/man-pages.git] / man3 / lround.3
CommitLineData
fea681da 1.\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
e1520273
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.\"
1ae6b2c7 7.TH LROUND 3 2021-03-22 GNU "Linux Programmer's Manual"
fea681da 8.SH NAME
c13182ef 9lround, lroundf, lroundl, llround, llroundf, llroundl \- round to
f6cf8f80 10nearest integer
ab50e426
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 lround(double " x );
19.BI "long lroundf(float " x );
20.BI "long lroundl(long double " x );
68e4db0a 21.PP
ae85f653
AC
22.BI "long long llround(double " x );
23.BI "long long llroundf(float " x );
24.BI "long long llroundl(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,
ce08dedc 38rounding halfway cases away from zero,
5dcc3b66
MK
39regardless of the current rounding direction (see
40.BR fenv (3)).
847e0d88 41.PP
14d70713
MK
42Note that unlike the
43.BR round (3)
44and
9dc0b7df 45.BR ceil (3),
14d70713 46functions, the return type of these functions differs from
9dc0b7df 47that of their arguments.
47297adb 48.SH RETURN VALUE
e1520273 49These functions return the rounded integer value.
847e0d88 50.PP
e1520273
MK
51If
52.I x
53is a NaN or an infinity,
54or the rounded value is too large to be stored in a
55.I long
56.RI ( "long long"
57in the case of the
58.B ll*
a27180c8 59functions),
efe294cb 60then a domain error occurs, and the return value is unspecified.
e1520273 61.\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
fea681da 62.SH ERRORS
e1520273
MK
63See
64.BR math_error (7)
65for information on how to determine whether an error has occurred
66when calling these functions.
67.PP
68The following errors can occur:
fea681da 69.TP
e1520273
MK
70Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
71.\" .I errno
72.\" is set to
73.\" .BR EDOM .
74An invalid floating-point exception
75.RB ( FE_INVALID )
76is raised.
77.PP
78These functions do not set
79.IR errno .
80.\" FIXME . Is it intentional that these functions do not set errno?
81.\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6797
f0d7ce1d
MK
82.SH VERSIONS
83These functions first appeared in glibc in version 2.1.
df348165 84.SH ATTRIBUTES
6c2b814e
PH
85For an explanation of the terms used in this section, see
86.BR attributes (7).
c466875e
MK
87.ad l
88.nh
6c2b814e
PH
89.TS
90allbox;
c466875e 91lbx lb lb
6c2b814e
PH
92l l l.
93Interface Attribute Value
94T{
df348165
PH
95.BR lround (),
96.BR lroundf (),
97.BR lroundl (),
98.BR llround (),
99.BR llroundf (),
df348165 100.BR llroundl ()
6c2b814e
PH
101T} Thread safety MT-Safe
102.TE
c466875e
MK
103.hy
104.ad
105.sp 1
47297adb 106.SH CONFORMING TO
9a74e018 107C99, POSIX.1-2001, POSIX.1-2008.
47297adb 108.SH SEE ALSO
fea681da
MK
109.BR ceil (3),
110.BR floor (3),
111.BR lrint (3),
112.BR nearbyint (3),
113.BR rint (3),
114.BR round (3)