Debian Codegraph @

upstream/debian-trixie/man3/lrint.3

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