tzfile.5, tzselect.8: sync from tzdb upstream
[man-pages.git] / man3 / lrint.3
blob7a0829a62eeb82b6846c2f7f6db63065a9be4d2d
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 lrint 3 (date) "Linux man-pages (unreleased)"
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 .PP
18 .BI "long lrint(double " x );
19 .BI "long lrintf(float " x );
20 .BI "long lrintl(long double " x );
21 .PP
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 .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 using the current rounding direction (see
39 .BR fesetround (3)).
40 .PP
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 .PP
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 .PP
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 .PP
76 These functions do not set
77 .IR errno .
78 .\" FIXME . Is it intentional that these functions do not set errno?
79 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6798
80 .SH VERSIONS
81 These functions were added in glibc 2.1.
82 .SH ATTRIBUTES
83 For an explanation of the terms used in this section, see
84 .BR attributes (7).
85 .ad l
86 .nh
87 .TS
88 allbox;
89 lbx lb lb
90 l l l.
91 Interface       Attribute       Value
93 .BR lrint (),
94 .BR lrintf (),
95 .BR lrintl (),
96 .BR llrint (),
97 .BR llrintf (),
98 .BR llrintl ()
99 T}      Thread safety   MT-Safe
103 .sp 1
104 .SH STANDARDS
105 C99, POSIX.1-2001, POSIX.1-2008.
106 .SH SEE ALSO
107 .BR ceil (3),
108 .BR floor (3),
109 .BR lround (3),
110 .BR nearbyint (3),
111 .BR rint (3),
112 .BR round (3)