]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/lrint.3
execve.2, setfsgid.2, setfsuid.2, splice.2, fopen.3, malloc_trim.3, posix_memalign...
[thirdparty/man-pages.git] / man3 / lrint.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 .\" %%%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 2017-09-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 .PP
34 .BI "long int lrint(double " x );
35 .BI "long int lrintf(float " x );
36 .BI "long int lrintl(long double " x );
37 .PP
38 .BI "long long int llrint(double " x );
39 .BI "long long int llrintf(float " x );
40 .BI "long long int llrintl(long double " x );
41 .fi
42 .PP
43 Link with \fI\-lm\fP.
44 .PP
45 .in -4n
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
48 .in
49 .PP
50 .ad l
51 All functions shown above:
52 .RS 4
53 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
54 .RE
55 .ad
56 .SH DESCRIPTION
57 These functions round their argument to the nearest integer value,
58 using the current rounding direction (see
59 .BR fesetround (3)).
60 .PP
61 Note that unlike the
62 .BR rint (3)
63 family of functions,
64 the return type of these functions differs from
65 that of their arguments.
66 .SH RETURN VALUE
67 These functions return the rounded integer value.
68 .PP
69 If
70 .I x
71 is a NaN or an infinity,
72 or the rounded value is too large to be stored in a
73 .I long
74 .RI ( "long long"
75 in the case of the
76 .B ll*
77 functions),
78 then a domain error occurs, and the return value is unspecified.
79 .\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
80 .SH ERRORS
81 See
82 .BR math_error (7)
83 for information on how to determine whether an error has occurred
84 when calling these functions.
85 .PP
86 The following errors can occur:
87 .TP
88 Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
89 .\" .I errno
90 .\" is set to
91 .\" .BR EDOM .
92 An invalid floating-point exception
93 .RB ( FE_INVALID )
94 is raised.
95 .PP
96 These functions do not set
97 .IR errno .
98 .\" FIXME . Is it intentional that these functions do not set errno?
99 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6798
100 .SH VERSIONS
101 These functions first appeared in glibc in version 2.1.
102 .SH ATTRIBUTES
103 For an explanation of the terms used in this section, see
104 .BR attributes (7).
105 .TS
106 allbox;
107 lbw30 lb lb
108 l l l.
109 Interface Attribute Value
110 T{
111 .BR lrint (),
112 .BR lrintf (),
113 .BR lrintl (),
114 .br
115 .BR llrint (),
116 .BR llrintf (),
117 .BR llrintl ()
118 T} Thread safety MT-Safe
119 .TE
120 .SH CONFORMING TO
121 C99, POSIX.1-2001, POSIX.1-2008.
122 .SH SEE ALSO
123 .BR ceil (3),
124 .BR floor (3),
125 .BR lround (3),
126 .BR nearbyint (3),
127 .BR rint (3),
128 .BR round (3)