]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/lround.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / lround.3
1 .\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH LROUND 3 2021-03-22 "Linux man-pages (unreleased)"
8 .SH NAME
9 lround, lroundf, lroundl, llround, llroundf, llroundl \- round to
10 nearest integer
11 .SH LIBRARY
12 Math library
13 .RI ( libm ", " \-lm )
14 .SH SYNOPSIS
15 .nf
16 .B #include <math.h>
17 .PP
18 .BI "long lround(double " x );
19 .BI "long lroundf(float " x );
20 .BI "long lroundl(long double " x );
21 .PP
22 .BI "long long llround(double " x );
23 .BI "long long llroundf(float " x );
24 .BI "long long llroundl(long double " x );
25 .fi
26 .PP
27 .RS -4
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
30 .RE
31 .PP
32 All functions shown above:
33 .nf
34 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
35 .fi
36 .SH DESCRIPTION
37 These functions round their argument to the nearest integer value,
38 rounding halfway cases away from zero,
39 regardless of the current rounding direction (see
40 .BR fenv (3)).
41 .PP
42 Note that unlike the
43 .BR round (3)
44 and
45 .BR ceil (3),
46 functions, the return type of these functions differs from
47 that of their arguments.
48 .SH RETURN VALUE
49 These functions return the rounded integer value.
50 .PP
51 If
52 .I x
53 is a NaN or an infinity,
54 or the rounded value is too large to be stored in a
55 .I long
56 .RI ( "long long"
57 in the case of the
58 .B ll*
59 functions),
60 then a domain error occurs, and the return value is unspecified.
61 .\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
62 .SH ERRORS
63 See
64 .BR math_error (7)
65 for information on how to determine whether an error has occurred
66 when calling these functions.
67 .PP
68 The following errors can occur:
69 .TP
70 Domain 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 .
74 An invalid floating-point exception
75 .RB ( FE_INVALID )
76 is raised.
77 .PP
78 These 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
82 .SH VERSIONS
83 These functions first appeared in glibc in version 2.1.
84 .SH ATTRIBUTES
85 For an explanation of the terms used in this section, see
86 .BR attributes (7).
87 .ad l
88 .nh
89 .TS
90 allbox;
91 lbx lb lb
92 l l l.
93 Interface Attribute Value
94 T{
95 .BR lround (),
96 .BR lroundf (),
97 .BR lroundl (),
98 .BR llround (),
99 .BR llroundf (),
100 .BR llroundl ()
101 T} Thread safety MT-Safe
102 .TE
103 .hy
104 .ad
105 .sp 1
106 .SH STANDARDS
107 C99, POSIX.1-2001, POSIX.1-2008.
108 .SH SEE ALSO
109 .BR ceil (3),
110 .BR floor (3),
111 .BR lrint (3),
112 .BR nearbyint (3),
113 .BR rint (3),
114 .BR round (3)