userfaultfd.2: Describe memory types that can be used from 4.11
[man-pages.git] / man3 / lrint.3
blobe003a116a900d8adb1ccd7741c9ecf43f647b3cb
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 .\" %%%LICENSE_START(VERBATIM)
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.
14 .\"
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.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .TH LRINT 3  2016-03-15 "" "Linux Programmer's Manual"
28 .SH NAME
29 lrint, lrintf, lrintl, llrint, llrintf, llrintl \- round to nearest integer
30 .SH SYNOPSIS
31 .nf
32 .B #include <math.h>
33 .sp
34 .BI "long int lrint(double " x );
35 .br
36 .BI "long int lrintf(float " x );
37 .br
38 .BI "long int lrintl(long double " x );
39 .sp
40 .BI "long long int llrint(double " x );
41 .br
42 .BI "long long int llrintf(float " x );
43 .br
44 .BI "long long int llrintl(long double " x );
45 .fi
46 .sp
47 Link with \fI\-lm\fP.
48 .sp
49 .in -4n
50 Feature Test Macro Requirements for glibc (see
51 .BR feature_test_macros (7)):
52 .in
53 .sp
54 .ad l
55 All functions shown above:
56 .RS 4
57 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
58 .RE
59 .ad
60 .SH DESCRIPTION
61 These functions round their argument to the nearest integer value,
62 using the current rounding direction (see
63 .BR fesetround (3)).
65 Note that unlike the
66 .BR rint (3)
67 family of functions,
68 the return type of these functions differs from
69 that of their arguments.
70 .SH RETURN VALUE
71 These functions return the rounded integer value.
74 .I x
75 is a NaN or an infinity,
76 or the rounded value is too large to be stored in a
77 .I long
78 .RI ( "long long"
79 in the case of the
80 .B ll*
81 functions),
82 then a domain error occurs, and the return value is unspecified.
83 .\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
84 .SH ERRORS
85 See
86 .BR math_error (7)
87 for information on how to determine whether an error has occurred
88 when calling these functions.
89 .PP
90 The following errors can occur:
91 .TP
92 Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
93 .\" .I errno
94 .\" is set to
95 .\" .BR EDOM .
96 An invalid floating-point exception
97 .RB ( FE_INVALID )
98 is raised.
99 .PP
100 These functions do not set
101 .IR errno .
102 .\" FIXME . Is it intentional that these functions do not set errno?
103 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6798
104 .SH VERSIONS
105 These functions first appeared in glibc in version 2.1.
106 .SH ATTRIBUTES
107 For an explanation of the terms used in this section, see
108 .BR attributes (7).
110 allbox;
111 lbw30 lb lb
112 l l l.
113 Interface       Attribute       Value
115 .BR lrint (),
116 .BR lrintf (),
117 .BR lrintl (),
119 .BR llrint (),
120 .BR llrintf (),
121 .BR llrintl ()
122 T}      Thread safety   MT-Safe
124 .SH CONFORMING TO
125 C99, POSIX.1-2001, POSIX.1-2008.
126 .SH SEE ALSO
127 .BR ceil (3),
128 .BR floor (3),
129 .BR lround (3),
130 .BR nearbyint (3),
131 .BR rint (3),
132 .BR round (3)