OSDN Git Service

(split) LDP: Change Makefile to stamp-based compilation
[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  2010-09-20 "" "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
72 .BR round (3),
73 .BR ceil (3),
74 etc., the return type of these functions differs from
75 that of their arguments.
76 .SH RETURN VALUE
77 These functions return the rounded integer value.
78
79 If
80 .I x
81 is a NaN or an infinity,
82 or the rounded value is too large to be stored in a
83 .I long
84 .RI ( "long long"
85 in the case of the
86 .B ll*
87 functions)
88 then a domain error occurs, and the return value is unspecified.
89 .\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
90 .SH ERRORS
91 See
92 .BR math_error (7)
93 for information on how to determine whether an error has occurred
94 when calling these functions.
95 .PP
96 The following errors can occur:
97 .TP
98 Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
99 .\" .I errno
100 .\" is set to
101 .\" .BR EDOM .
102 An invalid floating-point exception
103 .RB ( FE_INVALID )
104 is raised.
105 .PP
106 These functions do not set
107 .IR errno .
108 .\" FIXME . Is it intentional that these functions do not set errno?
109 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6797
110 .SH VERSIONS
111 These functions first appeared in glibc in version 2.1.
112 .SH CONFORMING TO
113 C99, POSIX.1-2001.
114 .SH SEE ALSO
115 .BR ceil (3),
116 .BR floor (3),
117 .BR lrint (3),
118 .BR nearbyint (3),
119 .BR rint (3),
120 .BR round (3)