OSDN Git Service

93a39c8d7e156fda70a5d0438b78cf446b0c7cc6
[linuxjm/LDP_man-pages.git] / original / 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  2014-01-18 "" "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 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
58 _POSIX_C_SOURCE\ >=\ 200112L;
59 .br
60 or
61 .I cc\ -std=c99
62 .RE
63 .ad
64 .SH DESCRIPTION
65 These functions round their argument to the nearest integer value,
66 using the current rounding direction (see
67 .BR fesetround (3)).
68
69 Note that unlike the
70 .BR rint (3)
71 family of functions,
72 the return type of these functions differs from
73 that of their arguments.
74 .SH RETURN VALUE
75 These functions return the rounded integer value.
76
77 If
78 .I x
79 is a NaN or an infinity,
80 or the rounded value is too large to be stored in a
81 .I long
82 .RI ( "long long"
83 in the case of the
84 .B ll*
85 functions),
86 then a domain error occurs, and the return value is unspecified.
87 .\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
88 .SH ERRORS
89 See
90 .BR math_error (7)
91 for information on how to determine whether an error has occurred
92 when calling these functions.
93 .PP
94 The following errors can occur:
95 .TP
96 Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
97 .\" .I errno
98 .\" is set to
99 .\" .BR EDOM .
100 An invalid floating-point exception
101 .RB ( FE_INVALID )
102 is raised.
103 .PP
104 These functions do not set
105 .IR errno .
106 .\" FIXME . Is it intentional that these functions do not set errno?
107 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6798
108 .SH VERSIONS
109 These functions first appeared in glibc in version 2.1.
110 .SH ATTRIBUTES
111 .SS Multithreading (see pthreads(7))
112 The
113 .BR lrint (),
114 .BR lrintf (),
115 .BR lrintl (),
116 .BR llrint (),
117 .BR llrintf (),
118 and
119 .BR llrintl ()
120 functions are thread-safe.
121 .SH CONFORMING TO
122 C99, POSIX.1-2001.
123 .SH SEE ALSO
124 .BR ceil (3),
125 .BR floor (3),
126 .BR lround (3),
127 .BR nearbyint (3),
128 .BR rint (3),
129 .BR round (3)
130 .SH COLOPHON
131 This page is part of release 3.67 of the Linux
132 .I man-pages
133 project.
134 A description of the project,
135 information about reporting bugs,
136 and the latest version of this page,
137 can be found at
138 \%http://www.kernel.org/doc/man\-pages/.