1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
|
.\" Copyright (c) 2000 Andries Brouwer (aeb@cwi.nl)
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
.\"
.\" 2000-08-14 added GNU additions from Andreas Jaeger
.\" 2000-12-05 some changes inspired by acahalan's remarks
.\"
.\" Japanese Version Copyright (c) 2000-2001 NAKANO Takeo
.\" and Copyright (c) 2008 Akihiro MOTOKI.
.\" Translated 2001-02-08, NAKANO Takeo <nakano@apm.seikei.ac.jp>
.\" Updated 2003-10-15, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2005-02-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2008-09-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\"
.\"WORD: (floating-point) exception (ư) 㳰
.\"WORD: rounding ݤ
.\"WORD: opaque
.\"
.TH FENV 3 2008-08-11 "Linux" "Linux Programmer's Manual"
.SH ̾
feclearexcept, fegetexceptflag, feraiseexcept, fesetexceptflag,
fetestexcept, fegetenv, fegetround, feholdexcept, fesetround,
fesetenv, feupdateenv, feenableexcept, fedisableexcept,
fegetexcept \- ưδݤ㳰μ갷
.SH
.nf
.B #include <fenv.h>
.sp
.BI "int feclearexcept(int " excepts );
.br
.BI "int fegetexceptflag(fexcept_t *" flagp ", int " excepts );
.br
.BI "int feraiseexcept(int " excepts );
.br
.BI "int fesetexceptflag(const fexcept_t *" flagp ", int " excepts );
.br
.BI "int fetestexcept(int " excepts );
.sp
.B "int fegetround(void);"
.br
.BI "int fesetround(int " rounding_mode );
.sp
.BI "int fegetenv(fenv_t *" envp );
.br
.BI "int feholdexcept(fenv_t *" envp );
.br
.BI "int fesetenv(const fenv_t *" envp );
.br
.BI "int feupdateenv(const fenv_t *" envp );
.fi
.sp
\fI\-lm\fP ǥ롣
.SH
11 Ĥδؿ C99 Ƥꡢ
ưδݤ㳰 (Сեˤʤ)
μ갷ꤹ롣
.SS 㳰
.I divide-by-zero
㳰ϡͭ¤οͤФ黻
̵褦ʾ˵롣
.LP
.I overflow
㳰ϡ̤ưͤɽʤФʤʤΤˡ
ͤɽǽư (ͭ¤) ͤ
(ä) 礭ʤäƤޤ褦ʾ˵롣
.LP
.I underflow
㳰ϡ̤ưͤɽʤФʤʤΤˡ
ͤưκǾͤ
ʤäƤޤ
( ɽ٤äƤޤ)
褦ʾ˵롣
.LP
.I inexact
㳰ϡݤα黻̤
̵٤η̤Ȱۤʤ褦ʾ˵롣
.I overflow
㳰
.I underflow
㳰Ȥˤϡˤ㳰ⵯ롣
.LP
.I invalid
㳰ϡ黻̤ޤǤʤ̤褦ʾ˵롣
㤨 0/0̵ \- ̵硢sqrt(\-1) ʤɡ
.SS 㳰
㳰ɽˤ 2 Ĥˡ롣
ҤȤĤϡñΥӥåȤ (㳰äʤä) ɽˡǡ
ΥӥåȤΤӥåȰ֤бӥåȤбդ
¸Ǥ롣⤦Ĥϡ¤ΤȤäɽˡǡ
ˡ㳰˴ؤ¿ξ
(㤨㳰äɤΥɥ쥹ʤ) ޤޤ롣
.LP
.BR FE_DIVBYZERO ,
.BR FE_INEXACT ,
.BR FE_INVALID ,
.BR FE_OVERFLOW ,
.B FE_UNDERFLOW
γƥޥϡ줾б㳰ν
ݡȤƤ롣
ΤȤбӥåȤ줾뤳ȤˤʤΤǡ
㳰ؿθƤӽФ㤨
.BR FE_OVERFLOW | FE_UNDERFLOW
ȤΰѤƹԤȤǤ롣
¾㳰⥵ݡȤƤ뤫⤷ʤ
.B FE_ALL_EXCEPT
ޥϡݡȤƤ㳰бӥåȤƥåȤƤ
(ݡȤƤ㳰Ƥ¤Ǥ)
.PP
.BR feclearexcept ()
ؿϡ
.I excepts
Υӥåǻꤵ줿㳰ꥢ
(ϼǥݡȤƤ㳰ˤĤƤΤ߹Ԥ)
.LP
.BR fegetexceptflag ()
ؿϡ
.I excepts
ǻꤵ줿㳰ե饰ξ֤
.I *flagp
ؤ֥Ȥ¸롣
.LP
.BR feraiseexcept ()
ؿϡ
.I excepts
Υӥåǻꤵ줿㳰Τ
ݡȤƤΤȯ롣
.LP
.BR fesetexceptflag ()
ؿϡ
.I excepts
ǻꤵ줿㳰бե饰ξ֤
.I *flagp
ͤꤹ롣
.I *flagp
ͤϡδؿƤ
.BR fegetexceptflag ()
ؿƤӽФƼƤʤФʤʤ
(ΤȤ
.BR fegetexceptflag ()
κǸΰˤϡ
.BR fesetexceptflag ()
Ϥ
.I excepts
Τ٤ƤΥӥåȤޤͤꤹ뤳)
.LP
.BR fetestexcept ()
ؿϡ
.I excepts
ǥåȤƤӥåȤΤ
ꤵƤ㳰бӥåȤ 1 ˤʤäɤ֤
.SS ݤ⡼
ݤ⡼ɤϡ̤ΤɽǤʤݤˡ
ưη̤ɤΤ褦˰ΤǤ롣
ޤޤʴݤ⡼ɤ뤳ȤǤ:
Ǥᤤͤ˴ݤ (ǥե)
(̵˸ä) 礭ʤ˴ݤ롢
(̵˸ä) ʤ˴ݤ롢
0 ˸ƴݤ롢Ǥ롣
.BR FE_TONEAREST ,
.BR FE_UPWARD ,
.BR FE_DOWNWARD ,
.BR FE_TOWARDZERO
γƥޥϡ줾бݤ
ݡȤƤ롣
.LP
.BR fegetround ()
ؿϸߤδݤ⡼ɤбޥ֤
.LP
.BR fesetround ()
ؿϴݤ⡼ɤͿ줿ͤˤ
饼֤
C99 POSIX.1-2008 Ǥ
.B FLT_ROUNDS
Ȥ̻ҤꤵƤꡢ
.I <float.h>
Ƥ롣μ̻Ҥ
ưβûˤĤƤμ줿ݤưɽ
ʲΤ줫ͤġ
.IP \-1
ݤ⡼ɤϷƤʤ
.IP 0
0 ˸ƴݤ롣
.IP 1
Ǥᤤ˴ݤ롣
.IP 2
̵˸ƴݤ롣
.IP 3
̵˸ƴݤ롣
.PP
¾ͤϥޥ¸ǤꡢɸŪǤϤʤݤ⡼ɤǤ롣
.PP
.BR FLT_ROUNDS
ͤˤϡ
.BR fesetround ()
ꤵ줿ߤδݤ⡼ɤȿǤ٤Ǥ
(â֥Хפ)
.SS ưϢδĶ
ưϢδĶΤϡ
⡼ɤ֥ե饰ޤᡢ
.I fenv_t
֥ȰĤǼ갷ȤǤ롣
ǥեȤδĶϡ
.RI ( "const fenv_t *"
)
.B FE_DFL_ENV
ǼΤǤ롣
ϥץγϻ˹ۤĶǤꡢ
ISO C Ǥϡݤ⡼ɤǤᤤͤؤδݤ
.RB ( FE_TONEAREST )
ꤷ٤Ƥ㳰ꥢ (non-stop)
(㳰Ƥ³) ⡼ɤȤ褦˵ꤵƤ롣
.LP
.BR fegetenv ()
ؿϡߤưĶ֥
.I *envp
¸롣
.LP
.BR feholdexcept ()
ؿƱưԤ
˲ǽǤСƤ㳰ե饰ꥢ
non-stop (㳰ˤ¹Ԥ³) ⡼ɤꤹ롣
.LP
.BR fesetenv ()
ؿϡưĶ֥
.I *envp
Ф᤹ͤ
Υ֥ȤϡͭǤ뤳ȤʬäƤʤФʤʤ
㤨С
.BR fegetenv ()
.BR feholdexcept ()
ƤӽФ̤ǤȤ
.B FE_DFL_ENV
ȤǤʤФʤʤ
δؿθƤӽФ㳰ȯʤ
.LP
.BR feupdateenv ()
ؿϡ֥
.I *envp
ɽưĶȡ뤹롣
ȯƤ㳰ϥꥢʤ
δؿƤΩäƤ㳰ϡ
ؿƤͤ
.I *envp
ͤȤΥӥåȤȤ OR äΤˤʤ롣
嵭Ʊͤˡ֥
.I *envp
ϡͭǤ뤳ȤʬäƤʤФʤʤ
.SH ֤
δؿϡξ 0 ֤顼ȯ 0 ʳ֤
.\" ϡδؿΤ 7Ĥ void ֤ΤȽƤ
.\" C99 ɸ Corrigendum 1 (ISO/IEC 9899:1999/Cor.1:2001(E))
.\" ǽ줿
.SH С
δؿ glibc С 2.1 ǽо줷
.SH
IEC 60559 (IEC 559:1989), ANSI/IEEE 854, C99, POSIX.1-2001.
.SH
.SS glibc Ǥ
ǽʾˤϡGNU C Library ϥޥ
.B FE_NOMASK_ENV
롣ΥޥϤ٤Ƥ㳰ǥȥåפ褦ʴĶɽ
.B #ifdef
ȤäƤΥޥƥȤǤ롣
.B _GNU_SOURCE
Ƥ˸¤ä롣
C99 ɸưޥ (㤨Υե饰ǤΥȥåפʤ)
γƥӥåȤˡˤĤƤƤʤ
glibc 2.2
.BR feenableexcept ()
ؿ
.BR fedisableexcept ()
ؿݡȤƤꡢ
ơưȥåפǤ褦ˤʤäƤ롣
ޤ
.BR fegetexcept ()
ˤäƾ֤䤤碌Ǥ褦ˤʤäƤ롣
.sp
.nf
.B "#define _GNU_SOURCE"
.br
.B "#include <fenv.h>"
.sp
.BI "int feenableexcept(int " excepts );
.br
.BI "int fedisableexcept(int " excepts );
.br
.B "int fegetexcept(void);"
.br
.fi
.LP
.BR feenebleexcept ()
ؿ
.BR fedisableexcept ()
ؿ
.I excepts
ˤäɽ㳰Υȥåפͭ (̵) ˤ롣
ľͭˤʤäƤ㳰ΥåȤ֤
Ԥ \-1 ֤
.BR fegetexcept ()
ؿϸͭˤʤäƤ㳰Ƥʤ륻åȤ֤
.SH Х
C99 εǤϡ
.BR FLT_ROUNDS
ͤˤ
.BR fesetround ()
ꤵ줿ߤδݤ⡼ɤȿǤ٤ǤȤƤ롣
ߤΤȤ
.\" Aug 08, glibc 2.8
Τ褦ˤʤäƤ餺
.B FLT_ROUNDS
Ͼ 1 Ȥʤ롣
.\" See http://gcc.gnu.org/ml/gcc/2002-02/msg01535.html
.SH Ϣ
.BR feature_test_macros (7),
.BR math_error (7)
|