]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/lround.3
CPU_SET.3, INFINITY.3, __ppc_get_timebase.3, __ppc_set_ppr_med.3, __ppc_yield.3,...
[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.\"
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.\"
97986708 27.TH LROUND 3 2016-03-15 "" "Linux Programmer's Manual"
fea681da 28.SH NAME
c13182ef 29lround, lroundf, lroundl, llround, llroundf, llroundl \- round to
35478399 30nearest integer, away from zero
fea681da
MK
31.SH SYNOPSIS
32.nf
33.B #include <math.h>
68e4db0a 34.PP
fea681da
MK
35.BI "long int lround(double " x );
36.br
37.BI "long int lroundf(float " x );
38.br
39.BI "long int lroundl(long double " x );
68e4db0a 40.PP
fea681da
MK
41.BI "long long int llround(double " x );
42.br
43.BI "long long int llroundf(float " x );
44.br
45.BI "long long int llroundl(long double " x );
46.fi
68e4db0a 47.PP
cc4615cc 48Link with \fI\-lm\fP.
68e4db0a 49.PP
cc4615cc
MK
50.in -4n
51Feature Test Macro Requirements for glibc (see
52.BR feature_test_macros (7)):
53.in
68e4db0a 54.PP
cc4615cc
MK
55.ad l
56All functions shown above:
f1f0e4ed 57.RS 4
e464f054 58_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
f1f0e4ed
MK
59.RE
60.ad
fea681da
MK
61.SH DESCRIPTION
62These functions round their argument to the nearest integer value,
5dcc3b66
MK
63rounding away from zero,
64regardless of the current rounding direction (see
65.BR fenv (3)).
847e0d88 66.PP
14d70713
MK
67Note that unlike the
68.BR round (3)
69and
9dc0b7df 70.BR ceil (3),
14d70713 71functions, the return type of these functions differs from
9dc0b7df 72that of their arguments.
47297adb 73.SH RETURN VALUE
e1520273 74These functions return the rounded integer value.
847e0d88 75.PP
e1520273
MK
76If
77.I x
78is a NaN or an infinity,
79or the rounded value is too large to be stored in a
80.I long
81.RI ( "long long"
82in the case of the
83.B ll*
a27180c8 84functions),
efe294cb 85then a domain error occurs, and the return value is unspecified.
e1520273 86.\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
fea681da 87.SH ERRORS
e1520273
MK
88See
89.BR math_error (7)
90for information on how to determine whether an error has occurred
91when calling these functions.
92.PP
93The following errors can occur:
fea681da 94.TP
e1520273
MK
95Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
96.\" .I errno
97.\" is set to
98.\" .BR EDOM .
99An invalid floating-point exception
100.RB ( FE_INVALID )
101is raised.
102.PP
103These functions do not set
104.IR errno .
105.\" FIXME . Is it intentional that these functions do not set errno?
106.\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6797
f0d7ce1d
MK
107.SH VERSIONS
108These functions first appeared in glibc in version 2.1.
df348165 109.SH ATTRIBUTES
6c2b814e
PH
110For an explanation of the terms used in this section, see
111.BR attributes (7).
112.TS
113allbox;
114lbw33 lb lb
115l l l.
116Interface Attribute Value
117T{
df348165
PH
118.BR lround (),
119.BR lroundf (),
120.BR lroundl (),
6c2b814e 121.br
df348165
PH
122.BR llround (),
123.BR llroundf (),
df348165 124.BR llroundl ()
6c2b814e
PH
125T} Thread safety MT-Safe
126.TE
47297adb 127.SH CONFORMING TO
9a74e018 128C99, POSIX.1-2001, POSIX.1-2008.
47297adb 129.SH SEE ALSO
fea681da
MK
130.BR ceil (3),
131.BR floor (3),
132.BR lrint (3),
133.BR nearbyint (3),
134.BR rint (3),
135.BR round (3)