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