OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[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 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .TH LROUND 3  2008-08-11 "" "Linux Programmer's Manual"
26 .SH NAME
27 lround, lroundf, lroundl, llround, llroundf, llroundl \- round to
28 nearest integer, away from zero
29 .SH SYNOPSIS
30 .nf
31 .B #include <math.h>
32 .sp
33 .BI "long int lround(double " x );
34 .br
35 .BI "long int lroundf(float " x );
36 .br
37 .BI "long int lroundl(long double " x );
38 .sp
39 .BI "long long int llround(double " x );
40 .br
41 .BI "long long int llroundf(float " x );
42 .br
43 .BI "long long int llroundl(long double " x );
44 .fi
45 .sp
46 Link with \fI\-lm\fP.
47 .sp
48 .in -4n
49 Feature Test Macro Requirements for glibc (see
50 .BR feature_test_macros (7)):
51 .in
52 .sp
53 .ad l
54 All functions shown above:
55 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE; or
56 .I cc\ -std=c99
57 .ad b
58 .SH DESCRIPTION
59 These functions round their argument to the nearest integer value,
60 rounding away from zero,
61 regardless of the current rounding direction (see
62 .BR fenv (3)).
63
64 Note that unlike
65 .BR round (3),
66 .BR ceil (3),
67 etc., the return type of these functions differs from
68 that of their arguments.
69 .SH "RETURN VALUE"
70 These functions return the rounded integer value.
71
72 If
73 .I x
74 is a NaN or an infinity,
75 or the rounded value is too large to be stored in a
76 .I long
77 .RI ( "long long"
78 in the case of the
79 .B ll*
80 functions)
81 then a domain error occurs, and the return value is unspecified.
82 .\" The return value is -(LONG_MAX - 1) or -(LLONG_MAX -1)
83 .SH ERRORS
84 See
85 .BR math_error (7)
86 for information on how to determine whether an error has occurred
87 when calling these functions.
88 .PP
89 The following errors can occur:
90 .TP
91 Domain error: \fIx\fP is a NaN or infinite, or the rounded value is too large
92 .\" .I errno
93 .\" is set to
94 .\" .BR EDOM .
95 An invalid floating-point exception
96 .RB ( FE_INVALID )
97 is raised.
98 .PP
99 These functions do not set
100 .IR errno .
101 .\" FIXME . Is it intentional that these functions do not set errno?
102 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6797
103 .SH VERSIONS
104 These functions first appeared in glibc in version 2.1.
105 .SH "CONFORMING TO"
106 C99, POSIX.1-2001.
107 .SH "SEE ALSO"
108 .BR ceil (3),
109 .BR floor (3),
110 .BR lrint (3),
111 .BR nearbyint (3),
112 .BR rint (3),
113 .BR round (3)