OSDN Git Service

LDP: Update draft based on the previous commit
[linuxjm/jm.git] / manual / LDP_man-pages / draft / 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 .\"
33 .\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
34 .\" and Copyright (c) 2008 Akihiro MOTOKI
35 .\" Translated Tue Jan 21 20:52:09 JST 1997
36 .\"       by YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
37 .\" Updated & Modified Fri Jul  6 20:42:59 JST 2001
38 .\"       by Yuichi SATO <ysato@h4.dion.ne.jp>
39 .\" Updated & Modified Sun Jan 16 07:40:37 JST 2005
40 .\"       by Yuichi SATO <ysato444@yahoo.co.jp>
41 .\" Updated 2008-09-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
42 .\"
43 .TH RINT 3 2017\-09\-15 "" "Linux Programmer's Manual"
44 .SH 名前
45 nearbyint, nearbyintf, nearbyintl, rint, rintf, rintl \- 最も近い整数に丸める
46 .SH 書式
47 .nf
48 \fB#include <math.h>\fP
49 .PP
50 \fBdouble nearbyint(double \fP\fIx\fP\fB);\fP
51 \fBfloat nearbyintf(float \fP\fIx\fP\fB);\fP
52 \fBlong double nearbyintl(long double \fP\fIx\fP\fB);\fP
53 .PP
54 \fBdouble rint(double \fP\fIx\fP\fB);\fP
55 \fBfloat rintf(float \fP\fIx\fP\fB);\fP
56 \fBlong double rintl(long double \fP\fIx\fP\fB);\fP
57 .fi
58 .PP
59 \fI\-lm\fP でリンクする。
60 .PP
61 .RS -4
62 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
63 .RE
64 .PP
65 .ad l
66 \fBnearbyint\fP(), \fBnearbyintf\fP(), \fBnearbyintl\fP():
67 .RS 4
68 _POSIX_C_SOURCE\ >=\ 200112L || _ISOC99_SOURCE
69 .RE
70 .br
71 \fBrint\fP():
72 .RS 4
73 .\"    || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
74 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
75     || _XOPEN_SOURCE\ >=\ 500
76     || /* Since glibc 2.19: */ _DEFAULT_SOURCE
77     || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
78 .RE
79 .br
80 \fBrintf\fP(), \fBrintl\fP():
81 .RS 4
82 _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
83     || /* Since glibc 2.19: */ _DEFAULT_SOURCE
84     || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
85 .RE
86 .ad b
87 .SH 説明
88 The \fBnearbyint\fP(), \fBnearbyintf\fP(), and \fBnearbyintl\fP()  functions round
89 their argument to an integer value in floating\-point format, using the
90 current rounding direction (see \fBfesetround\fP(3))  and without raising the
91 \fIinexact\fP exception.  When the current rounding direction is to nearest,
92 these functions round halfway cases to the even integer in accordance with
93 IEEE\-754.
94 .PP
95 関数 \fBrint\fP(), \fBrintf\fP(), and \fBrintl\fP() も同じような動作をするが、 結果が引き数と異なる場合に
96 \fIinexact\fP 例外 (\fBFE_INEXACT\fP)  を出す (この例外は \fBfetestexcept\fP(3)  経由で確認可能)。
97 .SH 返り値
98 これらの関数は丸めた整数値を返す。
99 .PP
100 \fIx\fP が整数、+0、\-0、NaN、無限のいずれかの場合、 \fIx\fP そのものが返される。
101 .SH エラー
102 エラーは発生しない。 POSIX.1\-2001 にはオーバーフローでの範囲エラー (range error) の 記載がある。「注意」の節を参照のこと。
103 .SH 属性
104 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
105 .TS
106 allbox;
107 lbw26 lb lb
108 l l l.
109 インターフェース        属性  値
110 T{
111 \fBnearbyint\fP(),
112 \fBnearbyintf\fP(),
113 .br
114 \fBnearbyintl\fP(),
115 \fBrint\fP(),
116 .br
117 \fBrintf\fP(),
118 \fBrintl\fP()
119 T}      Thread safety   MT\-Safe
120 .TE
121 .SH 準拠
122 C99, POSIX.1\-2001, POSIX.1\-2008.
123 .SH 注意
124 SUSv2 と POSIX.1\-2001 にはオーバーフローに関する記述があり、 オーバーフローの場合には、 \fIerrno\fP を \fBERANGE\fP
125 に設定するか、 \fBFE_OVERFLOW\fP 例外を発生することとされている。
126 実際のところ、どの現行のマシンでも結果がオーバーフローを起こすことはないので、 このエラー処理は意味がない。
127 (より正確に言うと、オーバーフローは指数部の最大値が 仮数部を表すビットの数より小さい場合にしか起こらない。 IEEE\-754 規格の 32 ビットと
128 64 ビットの浮動小数では、 指数部の最大値はそれぞれ 128 と 1024 であり、 仮数部のビット数はそれぞれ 24 と 53 である。)
129 .PP
130 丸めた値を整数型に格納した場合には、おそらくこの関数ではなく \fBlrint\fP(3)  に載っている関数のどれかを使いたいのだろう。
131 .SH 関連項目
132 \fBceil\fP(3), \fBfloor\fP(3), \fBlrint\fP(3), \fBround\fP(3), \fBtrunc\fP(3)
133 .SH この文書について
134 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
135 \%https://www.kernel.org/doc/man\-pages/ に書かれている。