OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / original / man3 / lround.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 LROUND 3  2013-08-26 "" "Linux Programmer's Manual"
28 .SH NAME
29 lround, lroundf, lroundl, llround, llroundf, llroundl \- round to
30 nearest integer, away from zero
31 .SH SYNOPSIS
32 .nf
33 .B #include <math.h>
34 .sp
35 .BI "long int lround(double " x );
36 .br
37 .BI "long int lroundf(float " x );
38 .br
39 .BI "long int lroundl(long double " x );
40 .sp
41 .BI "long long int llround(double " x );
42 .br
43 .BI "long long int llroundf(float " x );
44 .br
45 .BI "long long int llroundl(long double " x );
46 .fi
47 .sp
48 Link with \fI\-lm\fP.
49 .sp
50 .in -4n
51 Feature Test Macro Requirements for glibc (see
52 .BR feature_test_macros (7)):
53 .in
54 .sp
55 .ad l
56 All functions shown above:
57 .RS 4
58 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
59 _POSIX_C_SOURCE\ >=\ 200112L;
60 .br
61 or
62 .I cc\ -std=c99
63 .RE
64 .ad
65 .SH DESCRIPTION
66 These functions round their argument to the nearest integer value,
67 rounding away from zero,
68 regardless of the current rounding direction (see
69 .BR fenv (3)).
70
71 Note that unlike the
72 .BR round (3)
73 and
74 .BR ceil (3),
75 functions, the return type of these functions differs from
76 that of their arguments.
77 .SH RETURN VALUE
78 These functions return the rounded integer value.
79
80 If
81 .I x
82 is a NaN or an infinity,
83 or the rounded value is too large to be stored in a
84 .I long
85 .RI ( "long long"
86 in the case of the
87 .B ll*
88 functions),
89 then a domain error occurs, and the return value is unspecified.
90 .\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
91 .SH ERRORS
92 See
93 .BR math_error (7)
94 for information on how to determine whether an error has occurred
95 when calling these functions.
96 .PP
97 The following errors can occur:
98 .TP
99 Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
100 .\" .I errno
101 .\" is set to
102 .\" .BR EDOM .
103 An invalid floating-point exception
104 .RB ( FE_INVALID )
105 is raised.
106 .PP
107 These functions do not set
108 .IR errno .
109 .\" FIXME . Is it intentional that these functions do not set errno?
110 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6797
111 .SH VERSIONS
112 These functions first appeared in glibc in version 2.1.
113 .SH ATTRIBUTES
114 .SS Multithreading (see pthreads(7))
115 The
116 .BR lround (),
117 .BR lroundf (),
118 .BR lroundl (),
119 .BR llround (),
120 .BR llroundf (),
121 and
122 .BR llroundl ()
123 functions are thread-safe.
124 .SH CONFORMING TO
125 C99, POSIX.1-2001.
126 .SH SEE ALSO
127 .BR ceil (3),
128 .BR floor (3),
129 .BR lrint (3),
130 .BR nearbyint (3),
131 .BR rint (3),
132 .BR round (3)
133 .SH COLOPHON
134 This page is part of release 3.79 of the Linux
135 .I man-pages
136 project.
137 A description of the project,
138 information about reporting bugs,
139 and the latest version of this page,
140 can be found at
141 \%http://www.kernel.org/doc/man\-pages/.