OSDN Git Service

(split) DP: release pages (catch up to 3.50).
[linuxjm/LDP_man-pages.git] / release / man3 / rint.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 .\"*******************************************************************
28 .\"
29 .\" This file was generated with po4a. Translate the source file.
30 .\"
31 .\"*******************************************************************
32 .TH RINT 3 2010\-09\-20 "" "Linux Programmer's Manual"
33 .SH 名前
34 nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl \- 最も近い整数に丸める
35 .SH 書式
36 .nf
37 \fB#include <math.h>\fP
38 .sp
39 \fBdouble nearbyint(double \fP\fIx\fP\fB);\fP
40 .br
41 \fBfloat nearbyintf(float \fP\fIx\fP\fB);\fP
42 .br
43 \fBlong double nearbyintl(long double \fP\fIx\fP\fB);\fP
44 .sp
45 \fBdouble rint(double \fP\fIx\fP\fB);\fP
46 .br
47 \fBfloat rintf(float \fP\fIx\fP\fB);\fP
48 .br
49 \fBlong double rintl(long double \fP\fIx\fP\fB);\fP
50 .fi
51 .sp
52 \fI\-lm\fP でリンクする。
53 .sp
54 .in -4n
55 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
56 .in
57 .sp
58 .ad l
59 \fBnearbyint\fP(), \fBnearbyintf\fP(), \fBnearbyintl\fP():
60 .RS 4
61 _XOPEN_SOURCE\ >=\ 600 || _POSIX_C_SOURCE\ >=\ 200112L ||
62 _ISOC99_SOURCE;
63 .br
64 or \fIcc\ \-std=c99\fP
65 .RE
66 .br
67 \fBrint\fP():
68 .RS 4
69 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED || _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L;
70 .br
71 or \fIcc\ \-std=c99\fP
72 .RE
73 .br
74 \fBrintf\fP(), \fBrintl\fP():
75 .RS 4
76 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE
77 || _POSIX_C_SOURCE\ >=\ 200112L;
78 .br
79 or \fIcc\ \-std=c99\fP
80 .RE
81 .ad b
82 .SH 説明
83 \fBnearbyint\fP()  関数群は、現在の丸め方向 (\fBfesetround\fP(3)  参照) で引き数を浮動小数点形式の整数に丸める。
84 \fIinexact\fP 例外を出さない。
85 .LP
86 \fBrint\fP()  関数群も同じような動作をするが、 結果が引き数と異なる場合に \fIinexact\fP 例外 (\fBFE_INEXACT\fP)  を出す
87 (この例外は \fBfetestexcept\fP(3)  経由で確認可能)。
88 .SH 返り値
89 これらの関数は丸めた整数値を返す。
90
91 \fIx\fP が整数、+0、\-0、NaN、無限のいずれかの場合、 \fIx\fP そのものが返される。
92 .SH エラー
93 エラーは発生しない。 POSIX.1\-2001 にはオーバーフローでの範囲エラー (range error) の 記載がある。「注意」の節を参照のこと。
94 .SH 準拠
95 C99, POSIX.1\-2001.
96 .SH 注意
97 SUSv2 と POSIX.1\-2001 にはオーバーフローに関する記述があり、 オーバーフローの場合には、 \fIerrno\fP を \fBERANGE\fP
98 に設定するか、 \fBFE_OVERFLOW\fP 例外を発生することとされている。
99 実際のところ、どの現行のマシンでも結果がオーバーフローを起こすことはないので、 このエラー処理は意味がない。
100 (より正確に言うと、オーバーフローは指数部の最大値が 仮数部を表すビットの数より小さい場合にしか起こらない。 IEEE\-754 規格の 32 ビットと
101 64 ビットの浮動小数では、 指数部の最大値はそれぞれ 128 と 1024 であり、 仮数部のビット数はそれぞれ 24 と 53 である。)
102
103 丸めた値を整数型に格納した場合には、おそらくこの関数ではなく \fBlrint\fP(3)  に載っている関数のどれかを使いたいのだろう。
104 .SH 関連項目
105 \fBceil\fP(3), \fBfloor\fP(3), \fBlrint\fP(3), \fBround\fP(3), \fBtrunc\fP(3)
106 .SH この文書について
107 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
108 である。プロジェクトの説明とバグ報告に関する情報は
109 http://www.kernel.org/doc/man\-pages/ に書かれている。