1 .\" Copyright (c) 2000 Andries Brouwer (aeb@cwi.nl)
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" 2000-08-14 added GNU additions from Andreas Jaeger
24 .\" 2000-12-05 some changes inspired by acahalan's remarks
26 .\" Japanese Version Copyright (c) 2000-2001 NAKANO Takeo
27 .\" and Copyright (c) 2008 Akihiro MOTOKI.
28 .\" Translated 2001-02-08, NAKANO Takeo <nakano@apm.seikei.ac.jp>
29 .\" Updated 2003-10-15, Kentaro Shirakata <argrath@ub32.org>
30 .\" Updated 2005-02-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
31 .\" Updated 2008-09-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
33 .\"WORD: (floating-point) exception (ÉâÆ°¾®¿ôÅÀ) Îã³°
34 .\"WORD: rounding ´Ý¤á
35 .\"WORD: opaque ÆâÉô¤Î
37 .TH FENV 3 2010-10-31 "Linux" "Linux Programmer's Manual"
40 .\"O feclearexcept, fegetexceptflag, feraiseexcept, fesetexceptflag,
41 .\"O fetestexcept, fegetenv, fegetround, feholdexcept, fesetround,
42 .\"O fesetenv, feupdateenv, feenableexcept, fedisableexcept,
43 .\"O fegetexcept \- floating-point rounding and exception handling
44 feclearexcept, fegetexceptflag, feraiseexcept, fesetexceptflag,
45 fetestexcept, fegetenv, fegetround, feholdexcept, fesetround,
46 fesetenv, feupdateenv, feenableexcept, fedisableexcept,
47 fegetexcept \- ÉâÆ°¾®¿ôÅÀ¤Î´Ý¤á¤ÈÎã³°¤Î¼è¤ê°·¤¤
53 .BI "int feclearexcept(int " excepts );
55 .BI "int fegetexceptflag(fexcept_t *" flagp ", int " excepts );
57 .BI "int feraiseexcept(int " excepts );
59 .BI "int fesetexceptflag(const fexcept_t *" flagp ", int " excepts );
61 .BI "int fetestexcept(int " excepts );
63 .B "int fegetround(void);"
65 .BI "int fesetround(int " rounding_mode );
67 .BI "int fegetenv(fenv_t *" envp );
69 .BI "int feholdexcept(fenv_t *" envp );
71 .BI "int fesetenv(const fenv_t *" envp );
73 .BI "int feupdateenv(const fenv_t *" envp );
76 .\"O Link with \fI\-lm\fP.
77 \fI\-lm\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
80 .\"O These eleven functions were defined in C99, and describe the handling
81 .\"O of floating-point rounding and exceptions (overflow, zero-divide etc.).
82 ¤³¤ì¤é¤Î 11 ¸Ä¤Î´Ø¿ô¤Ï C99 ¤ÇÄêµÁ¤µ¤ì¤Æ¤ª¤ê¡¢
83 ÉâÆ°¾®¿ôÅÀ¤Î´Ý¤á¤ÈÎã³° (¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¡¢¥¼¥í¤Ë¤è¤ë½ü»»¤Ê¤É)
84 ¤Î¼è¤ê°·¤¤¤òµ¬Äꤹ¤ë¡£
88 .\"O .I divide-by-zero
89 .\"O exception occurs when an operation on finite numbers
90 .\"O produces infinity as exact answer.
92 Îã³°¤Ï¡¢Í¸Â¤Î¿ôÃͤËÂФ¹¤ë±é»»¤¬¡¢
93 ̵¸ÂÂç¤ÎÅú¤¨¤òÀ¸À®¤¹¤ë¤è¤¦¤Ê¾ì¹ç¤Ëµ¯¤³¤ë¡£
97 .\"O exception occurs when a result has to be represented as a
98 .\"O floating-point number, but has (much) larger absolute value than the
99 .\"O largest (finite) floating-point number that is representable.
101 Îã³°¤Ï¡¢·ë²Ì¤¬ÉâÆ°¾®¿ôÅÀ¿ôÃͤÇɽµ¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Î¤Ë¡¢
102 ¤½¤ÎÀäÂÐÃͤ¬É½¸½²Äǽ¤ÊÉâÆ°¾®¿ôÅÀ¿ô¤Î (͸¤Î) ºÇÂçÃͤè¤ê¤â
103 (¤º¤Ã¤È) Â礤¯¤Ê¤Ã¤Æ¤·¤Þ¤¦¤è¤¦¤Ê¾ì¹ç¤Ëµ¯¤³¤ë¡£
107 .\"O exception occurs when a result has to be represented as a
108 .\"O floating-point number, but has smaller absolute value than the smallest
109 .\"O positive normalized floating-point number (and would lose much accuracy
110 .\"O when represented as a denormalized number).
112 Îã³°¤Ï¡¢·ë²Ì¤¬ÉâÆ°¾®¿ôÅÀ¿ôÃͤÇɽµ¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Î¤Ë¡¢
113 ¤½¤ÎÀäÂÐÃͤ¬Àµ¤ÎÀµµ¬²½ÉâÆ°¾®¿ôÅÀ¿ô¤ÎºÇ¾®Ãͤè¤ê¤â
115 (¤½¤·¤Æ ÈóÀµµ¬²½¿ô¤Çɽ¸½¤·¤¿¾ì¹ç¤ËÈó¾ï¤ËÀºÅÙ¤ò¼º¤Ã¤Æ¤·¤Þ¤¦)
120 .\"O exception occurs when the rounded result of an operation
121 .\"O is not equal to the infinite precision result.
122 .\"O It may occur whenever
128 Îã³°¤Ï¡¢´Ý¤á¸å¤Î±é»»·ë²Ì¤¬¡¢
129 ̵¸ÂÀºÅ٤ηë²Ì¤È°Û¤Ê¤ë¤è¤¦¤Ê¾ì¹ç¤Ëµ¯¤³¤ë¡£
133 Îã³°¤¬µ¯¤¤¿¤È¤¤Ë¤Ï¡¢¾ï¤Ë¤³¤ÎÎã³°¤âµ¯¤³¤ë¡£
137 .\"O exception occurs when there is no well-defined result
138 .\"O for an operation, as for 0/0 or infinity \- infinity or sqrt(\-1).
140 Îã³°¤Ï¡¢±é»»·ë²Ì¤¬¤¦¤Þ¤¯ÄêµÁ¤Ç¤¤Ê¤¤·ë²Ì¤òÀ¸¤¸¤ë¤è¤¦¤Ê¾ì¹ç¤Ëµ¯¤³¤ë¡£
141 Î㤨¤Ð 0/0¡¢Ìµ¸ÂÂç \- ̵¸ÂÂç¡¢sqrt(\-1) ¤Ê¤É¡£
142 .\"O .SS "Exception handling"
144 .\"O Exceptions are represented in two ways: as a single bit
145 .\"O (exception present/absent), and these bits correspond in some
146 .\"O implementation-defined way with bit positions in an integer,
147 .\"O and also as an opaque structure that may contain more information
148 .\"O about the exception (perhaps the code address where it occurred).
149 Îã³°¤Îɽ¤·Êý¤Ë¤Ï 2 ¤Ä¤ÎÊýË¡¤¬¤¢¤ë¡£
150 ¤Ò¤È¤Ä¤Ï¡¢Ã±°ì¤Î¥Ó¥Ã¥È¤Ç (Îã³°¤¬¤¢¤Ã¤¿¤«¤Ê¤«¤Ã¤¿¤«¤ò) ɽ¤¹ÊýË¡¤Ç¡¢
151 ¤³¤ì¤é¤Î¥Ó¥Ã¥È¤ÏÀ°¿ô¤Î¤¢¤ë¥Ó¥Ã¥È°ÌÃÖ¤ËÂбþ¤·¡¢¥Ó¥Ã¥È¤ÎÂбþÉÕ¤±¤Ï
152 ¼ÂÁõ°Í¸¤Ç¤¢¤ë¡£¤â¤¦°ì¤Ä¤Ï¡¢ÆâÉô¹½Â¤ÂΤò»È¤Ã¤Æɽ¤¹ÊýË¡¤Ç¡¢
153 ¤³¤ÎÊýË¡¤ÎÊý¤¬Îã³°¤Ë´Ø¤¹¤ë¤è¤ê¿¤¯¤Î¾ðÊó
154 (Î㤨¤ÐÎã³°¤¬µ¯¤³¤Ã¤¿¥³¡¼¥É¤Î¥¢¥É¥ì¥¹¤Ê¤É) ¤¬´Þ¤Þ¤ì¤ë¡£
156 .\"O Each of the macros
157 .\"O .BR FE_DIVBYZERO ,
158 .\"O .BR FE_INEXACT ,
159 .\"O .BR FE_INVALID ,
160 .\"O .BR FE_OVERFLOW ,
162 .\"O is defined when the implementation supports handling
163 .\"O of the corresponding exception, and if so then
164 .\"O defines the corresponding bit(s), so that one can call
165 .\"O exception handling functions, for example, using the integer argument
166 .\"O .BR FE_OVERFLOW | FE_UNDERFLOW .
167 .\"O Other exceptions may be supported.
169 .\"O .B FE_ALL_EXCEPT
170 .\"O is the bitwise OR of all bits corresponding to supported exceptions.
176 ¤Î³Æ¥Þ¥¯¥í¤Ï¡¢¤½¤ì¤¾¤ìÂбþ¤¹¤ëÎã³°¤Î½èÍý¤ò
177 ¼ÂÁõ¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¾ì¹ç¤ËÄêµÁ¤µ¤ì¤ë¡£
178 ¤³¤Î¤È¤Âбþ¤¹¤ë¥Ó¥Ã¥È¤ò¤½¤ì¤¾¤ìÄêµÁ¤¹¤ë¤³¤È¤Ë¤Ê¤ë¤Î¤Ç¡¢
179 Îã³°½èÍý´Ø¿ô¤Î¸Æ¤Ó½Ð¤·¤ò¡¢Î㤨¤Ð
180 .BR FE_OVERFLOW | FE_UNDERFLOW
181 ¤È¤¤¤¦À°¿ô¤Î°ú¤¿ô¤òÍѤ¤¤Æ¹Ô¤¦¤³¤È¤¬¤Ç¤¤ë¡£
182 ¾¤ÎÎã³°¤â¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
184 ¥Þ¥¯¥í¤Ï¡¢¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ëÎã³°¤ËÂбþ¤¹¤ë¥Ó¥Ã¥È¤¬Á´¤Æ¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ë
185 (¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ëÎã³°Á´¤Æ¤ÎÏÀÍýϤǤ¢¤ë)¡£
188 .\"O .BR feclearexcept ()
189 .\"O function clears the supported exceptions represented by the bits
190 .\"O in its argument.
194 ¤Î¥Ó¥Ã¥ÈÎó¤Ç»ØÄꤵ¤ì¤¿Îã³°¤ò¥¯¥ê¥¢¤¹¤ë
195 (½èÍý¤Ï¼ÂÁõ¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ëÎã³°¤Ë¤Ä¤¤¤Æ¤Î¤ß¹Ô¤ï¤ì¤ë)¡£
198 .\"O .BR fegetexceptflag ()
199 .\"O function stores a representation of the state of the exception flags
200 .\"O represented by the argument
202 .\"O in the opaque object
204 .BR fegetexceptflag ()
207 ¤Ç»ØÄꤵ¤ì¤¿Îã³°¥Õ¥é¥°¤Î¾õÂÖ¤ò
209 ¤¬»Ø¤¹ÆâÉô¥ª¥Ö¥¸¥§¥¯¥È¤ËÊݸ¤¹¤ë¡£
212 .\"O .BR feraiseexcept ()
213 .\"O function raises the supported exceptions represented by the bits in
218 ¤Î¥Ó¥Ã¥ÈÎó¤Ç»ØÄꤵ¤ì¤¿Îã³°¤Î¤¦¤Á¡¢
219 ¼ÂÁõ¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¤â¤Î¤òȯÀ¸¤µ¤»¤ë¡£
222 .\"O .BR fesetexceptflag ()
223 .\"O function sets the complete status for the exceptions represented by
227 .\"O This value must have been obtained by an earlier call of
228 .\"O .BR fegetexceptflag ()
229 .\"O with a last argument that contained all bits in
231 .BR fesetexceptflag ()
234 ¤Ç»ØÄꤵ¤ì¤¿Îã³°¤ËÂбþ¤¹¤ë¥Õ¥é¥°¤Î¾õÂÖ¤ò
238 ¤ÎÃͤϡ¢¤³¤Î´Ø¿ô¤ò¸Æ¤ÖÁ°¤Ë
239 .BR fegetexceptflag ()
240 ´Ø¿ô¤ò¸Æ¤Ó½Ð¤·¤Æ¼èÆÀ¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤
242 .BR fegetexceptflag ()
244 .BR fesetexceptflag ()
247 ¤Î¤¹¤Ù¤Æ¤Î¥Ó¥Ã¥È¤ò´Þ¤àÃͤò»ØÄꤹ¤ë¤³¤È)¡£
250 .\"O .BR fetestexcept ()
251 .\"O function returns a word in which the bits are set that were
252 .\"O set in the argument
254 .\"O and for which the corresponding exception is currently set.
258 °ú¤¿ô¤Ç¥»¥Ã¥È¤µ¤ì¤Æ¤¤¤ë¥Ó¥Ã¥È¤Î¤¦¤Á¡¢
259 ¸½ºßÀßÄꤵ¤ì¤Æ¤¤¤ëÎã³°¤ËÂбþ¤¹¤ë¥Ó¥Ã¥È¤¬ 1 ¤Ë¤Ê¤Ã¤¿¥ï¡¼¥É¤òÊÖ¤¹¡£
260 .\"O .SS Rounding mode
262 .\"O The rounding mode determines how the result of floating-point operations
263 .\"O is treated when the result cannot be exactly represented in the significand.
264 .\"O Various rounding modes may be provided:
265 .\"O round to nearest (the default),
266 .\"O round up (toward positive infinity),
267 .\"O round down (toward negative infinity), and
268 .\"O round toward zero.
269 ´Ý¤á¥â¡¼¥É¤Ï¡¢·ë²Ì¤¬²¾¿ôÉô¤À¤±¤ÇÀµ³Î¤Ëɽ¸½¤Ç¤¤Ê¤¤ºÝ¤Ë¡¢
270 ÉâÆ°¾®¿ôÅÀÁàºî¤Î·ë²Ì¤ò¤É¤Î¤è¤¦¤Ë°·¤¦¤«¤ò·è¤á¤ë¤â¤Î¤Ç¤¢¤ë¡£
271 ¤µ¤Þ¤¶¤Þ¤Ê´Ý¤á¥â¡¼¥É¤òÄ󶡤¹¤ë¤³¤È¤¬¤Ç¤¤ë:
272 ºÇ¤â¶á¤¤Ãͤ˴ݤá¤ë (¥Ç¥Õ¥©¥ë¥È)¡¢
273 (Àµ¤Î̵¸ÂÂç¤Ë¸þ¤«¤Ã¤Æ) Â礤¯¤Ê¤ëÊý¸þ¤Ë´Ý¤á¤ë¡¢
274 (Éé¤Î̵¸ÂÂç¤Ë¸þ¤«¤Ã¤Æ) ¾®¤µ¤¯¤Ê¤ëÊý¸þ¤Ë´Ý¤á¤ë¡¢
275 0 ¤Ë¸þ¤±¤Æ´Ý¤á¤ë¡¢¤Ç¤¢¤ë¡£
277 .\"O Each of the macros
278 .\"O .BR FE_TONEAREST ,
280 .\"O .BR FE_DOWNWARD ,
282 .\"O .BR FE_TOWARDZERO
283 .\"O is defined when the implementation supports getting and setting
284 .\"O the corresponding rounding direction.
289 ¤Î³Æ¥Þ¥¯¥í¤Ï¡¢¤½¤ì¤¾¤ìÂбþ¤¹¤ë´Ý¤á¤ÎÊý¸þ¤ò
290 ¼ÂÁõ¤¬¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¾ì¹ç¤ËÄêµÁ¤µ¤ì¤ë¡£
293 .\"O .BR fegetround ()
294 .\"O function returns the macro corresponding to the current
297 ´Ø¿ô¤Ï¸½ºß¤Î´Ý¤á¥â¡¼¥É¤ËÂбþ¤¹¤ë¥Þ¥¯¥í¤òÊÖ¤¹¡£
300 .\"O .BR fesetround ()
301 .\"O function sets the rounding mode as specified by its argument
302 .\"O and returns zero when it was successful.
304 ´Ø¿ô¤Ï´Ý¤á¥â¡¼¥É¤ò°ú¤¿ô¤ËÍ¿¤¨¤é¤ì¤¿Ãͤˤ·¡¢
305 À®¸ù¤·¤¿¤é¥¼¥í¤òÊÖ¤¹¡£
307 .\"O C99 and POSIX.1-2008 specify an identifier,
308 .\"O .BR FLT_ROUNDS ,
311 .\"O which indicates the implementation-defined rounding
312 .\"O behavior for floating-point addition.
313 .\"O This identifier has one of the following values:
314 C99 ¤È POSIX.1-2008 ¤Ç¤Ï
316 ¤È¤¤¤¦¼±Ê̻Ҥ¬µ¬Äꤵ¤ì¤Æ¤ª¤ê¡¢
318 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¤³¤Î¼±Ê̻ҤÏ
319 ÉâÆ°¾®¿ôÅÀ¿ô¤Î²Ã»»¤Ë¤Ä¤¤¤Æ¤Î¼ÂÁõÄêµÁ¤µ¤ì¤¿´Ý¤áÆ°ºî¤òɽ¤·¡¢
320 °Ê²¼¤Î¤¤¤º¤ì¤«¤ÎÃͤò»ý¤Ä¡£
322 .\"O The rounding mode is not determinable.
323 ´Ý¤á¥â¡¼¥É¤Ï·è¤á¤é¤ì¤Æ¤¤¤Ê¤¤¡£
325 .\"O Rounding is toward 0.
328 .\"O Rounding is toward nearest number.
331 .\"O Rounding is toward positive infinity.
332 Àµ¤Î̵¸ÂÂç¤Ë¸þ¤±¤Æ´Ý¤á¤ë¡£
334 .\"O Rounding is toward negative infinity.
335 Éé¤Î̵¸ÂÂç¤Ë¸þ¤±¤Æ´Ý¤á¤ë¡£
337 .\"O Other values represent machine-dependent, nonstandard rounding modes.
338 ¾¤ÎÃͤϥޥ·¥ó°Í¸¤Ç¤¢¤ê¡¢É¸½àŪ¤Ç¤Ï¤Ê¤¤´Ý¤á¥â¡¼¥É¤Ç¤¢¤ë¡£
342 .\"O should reflect the current rounding mode as set by
343 .\"O .BR fesetround ()
348 ¤ÇÀßÄꤵ¤ì¤¿¸½ºß¤Î´Ý¤á¥â¡¼¥É¤¬È¿±Ç¤µ¤ì¤ë¤Ù¤¤Ç¤¢¤ë
349 (⤷¡¢¡Ö¥Ð¥°¡×¤ÎÀá¤ò»²¾È)¡£
350 .\"O .SS "Floating-point environment"
351 .SS ÉâÆ°¾®¿ôÅÀ´ØÏ¢¤Î´Ä¶
352 .\"O The entire floating-point environment, including
353 .\"O control modes and status flags, can be handled
354 .\"O as one opaque object, of type
356 .\"O The default environment is denoted by
359 .\"O .IR "const fenv_t *" ).
360 ÉâÆ°¾®¿ôÅÀ´ØÏ¢¤Î´Ä¶¤ÎÁ´ÂΤϡ¢
361 À©¸æ¥â¡¼¥É¤ä¾õÂ֥ե饰¤â´Þ¤á¡¢
363 ·¿¤ÎÆâÉô¥ª¥Ö¥¸¥§¥¯¥È°ì¤Ä¤Ç¼è¤ê°·¤¦¤³¤È¤¬¤Ç¤¤ë¡£
365 .RI ( "const fenv_t *"
368 ¤Ç¼¨¤µ¤ì¤ë¤â¤Î¤Ç¤¢¤ë¡£
369 .\"O This is the environment setup at program start and it is defined by
370 .\"O ISO C to have round to nearest, all exceptions cleared and a nonstop
371 .\"O (continue on exceptions) mode.
372 ¤³¤ì¤Ï¥×¥í¥°¥é¥à¤Î³«»Ï»þ¤Ë¹½ÃÛ¤µ¤ì¤ë´Ä¶¤Ç¤¢¤ê¡¢
373 ISO C ¤Ç¤Ï¡¢´Ý¤á¥â¡¼¥É¤òºÇ¤â¶á¤¤Ãͤؤδݤá
375 ¤ËÀßÄꤷ¡¢¤¹¤Ù¤Æ¤ÎÎã³°¤ò¥¯¥ê¥¢¤·¡¢ÉÔÄä»ß (nonstop)
376 (Îã³°¤¬µ¯¤¤Æ¤â·Ñ³¤¹¤ë) ¥â¡¼¥É¤È¤¹¤ë¤è¤¦¤Ëµ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
380 .\"O function saves the current floating-point environment in the object
383 ´Ø¿ô¤Ï¡¢¸½ºß¤ÎÉâÆ°¾®¿ôÅÀ´Ä¶¤ò¡¢¥ª¥Ö¥¸¥§¥¯¥È
388 .\"O .BR feholdexcept ()
389 .\"O function does the same, then clears all exception flags,
390 .\"O and sets a nonstop (continue on exceptions) mode,
392 .\"O It returns zero when successful.
394 ´Ø¿ô¤âƱ¤¸Æ°ºî¤ò¹Ô¤¤¡¢
395 ¤µ¤é¤Ë²Äǽ¤Ç¤¢¤ì¤Ð¡¢Á´¤Æ¤ÎÎã³°¥Õ¥é¥°¤ò¥¯¥ê¥¢¤·¡¢
396 nonstop (Îã³°»þ¤Ë¤â¼Â¹Ô¤ò·Ñ³) ¥â¡¼¥É¤ËÀßÄꤹ¤ë¡£
400 .\"O function restores the floating-point environment from
403 .\"O This object must be known to be valid, for example, the result of a call to
406 .\"O .BR feholdexcept ()
408 .\"O .BR FE_DFL_ENV .
409 .\"O This call does not raise exceptions.
411 ´Ø¿ô¤Ï¡¢ÉâÆ°¾®¿ôÅÀ´Ä¶¤ò¡¢¥ª¥Ö¥¸¥§¥¯¥È
413 ¤«¤é¼è¤ê½Ð¤·¤¿ÃͤËÌ᤹¡£
414 ¤³¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ï¡¢Í¸ú¤Ç¤¢¤ë¤³¤È¤¬»öÁ°¤Ëʬ¤«¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
419 ¤ò¸Æ¤Ó½Ð¤·¤¿·ë²Ì¤Ç¤¢¤ë¤È¤«¡¢
421 ¤ËÅù¤·¤¤¤È¤«¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
422 ¤³¤Î´Ø¿ô¤Î¸Æ¤Ó½Ð¤·¤ÏÎã³°¤òȯÀ¸¤·¤Ê¤¤¡£
425 .\"O .BR feupdateenv ()
426 .\"O function installs the floating-point environment represented by
429 .\"O except that currently raised exceptions are not cleared.
430 .\"O After calling this function, the raised exceptions will be a bitwise OR
431 .\"O of those previously set with those in
433 .\"O As before, the object
435 .\"O must be known to be valid.
439 ¤¬É½¸½¤¹¤ëÉâÆ°¾®¿ôÅÀ´Ä¶¤ò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¡£
440 ¤¿¤À¤·¡¢¸½ºßȯÀ¸¤·¤Æ¤¤¤ëÎã³°¤Ï¥¯¥ê¥¢¤µ¤ì¤Ê¤¤¡£
441 ¤³¤Î´Ø¿ô¤ò¸Æ¤ó¤À¸å¤ËΩ¤Ã¤Æ¤¤¤ëÎã³°¤Ï¡¢
444 ¤ÎÃͤȤΥӥåȤ´¤È¤Î OR ¤ò¼è¤Ã¤¿¤â¤Î¤Ë¤Ê¤ë¡£
445 ¾åµ¤ÈƱÍͤˡ¢¥ª¥Ö¥¸¥§¥¯¥È
447 ¤Ï¡¢»öÁ°¤Ë͸ú¤Ç¤¢¤ë¤³¤È¤¬Ê¬¤«¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
448 .\"O .SH "RETURN VALUE"
450 .\"O These functions return zero on success and nonzero if an error occurred.
451 .\"O .\" Earlier seven of these functions were listed as returning void.
452 .\"O .\" This was corrected in Corrigendum 1 (ISO/IEC 9899:1999/Cor.1:2001(E))
453 .\"O .\" of the C99 Standard.
454 ¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢À®¸ù¤Î¾ì¹ç 0 ¤òÊÖ¤·¡¢¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È 0 °Ê³°¤òÊÖ¤¹¡£
455 .\" °ÊÁ°¤Ï¡¢¤³¤ì¤é¤Î´Ø¿ô¤Î¤¦¤Á 7¤Ä¤Ï void ¤òÊÖ¤¹¤â¤Î¤È½ñ¤«¤ì¤Æ¤¤¤¿¡£
456 .\" ¤³¤ì¤Ï C99 ɸ½à¤Î Corrigendum 1 (ISO/IEC 9899:1999/Cor.1:2001(E))
460 .\"O These functions first appeared in glibc in version 2.1.
461 ¤³¤ì¤é¤Î´Ø¿ô¤Ï glibc ¥Ð¡¼¥¸¥ç¥ó 2.1 ¤Ç½é¤á¤ÆÅо줷¤¿¡£
462 .\"O .SH "CONFORMING TO"
464 IEC 60559 (IEC 559:1989), ANSI/IEEE 854, C99, POSIX.1-2001.
469 .\"O If possible, the GNU C Library defines a macro
470 .\"O .B FE_NOMASK_ENV
471 .\"O which represents an environment where every exception raised causes a
473 .\"O You can test for this macro using
475 .\"O It is only defined if
478 ²Äǽ¤Ê¾ì¹ç¤Ë¤Ï¡¢GNU C Library ¤Ï¥Þ¥¯¥í
480 ¤òÄêµÁ¤¹¤ë¡£¤³¤Î¥Þ¥¯¥í¤Ï¤¹¤Ù¤Æ¤ÎÎã³°¤Ç¥È¥é¥Ã¥×¤¬À¸¤¸¤ë¤è¤¦¤Ê´Ä¶¤òɽ¤¹¡£
482 ¤ò»È¤Ã¤Æ¤³¤Î¥Þ¥¯¥í¤ò¥Æ¥¹¥È¤Ç¤¤ë¡£¤³¤ì¤Ï
484 ¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ë¸Â¤Ã¤ÆÄêµÁ¤µ¤ì¤ë¡£
485 .\"O The C99 standard does not define a way to set individual bits in the
486 .\"O floating-point mask, for example, to trap on specific flags.
487 .\"O Since version 2.2, glibc supports the functions
488 .\"O .BR feenableexcept ()
490 .\"O .BR fedisableexcept ()
491 .\"O to set individual floating-point traps, and
492 .\"O .BR fegetexcept ()
493 .\"O to query the state.
494 C99 ɸ½à¤ÏÉâÆ°¾®¿ôÅÀ¥Þ¥¹¥¯ (Î㤨¤ÐÆÃÄê¤Î¥Õ¥é¥°¤Ç¤Î¥È¥é¥Ã¥×¤Ê¤É)
495 ¤Î³Æ¥Ó¥Ã¥È¤ÎÀßÄêÊýË¡¤Ë¤Ä¤¤¤Æ¤ÏÄêµÁ¤·¤Æ¤¤¤Ê¤¤¡£
496 ¥Ð¡¼¥¸¥ç¥ó 2.2 °Ê¹ß¤Î glibc ¤Ï¡¢
497 .BR feenableexcept ()
499 .BR fedisableexcept ()
500 ´Ø¿ô¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤ª¤ê¡¢
501 ³Æ¡¹¤ÎÉâÆ°¾®¿ôÅÀ¥È¥é¥Ã¥×¤òÀßÄê¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
504 ¤Ë¤è¤Ã¤Æ¾õÂÖ¤ÎÌ䤤¹ç¤ï¤»¤â¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
507 .\"O .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
508 .BR "#define _GNU_SOURCE" " /* feature_test_macros(7) »²¾È */"
509 .B "#define _GNU_SOURCE"
511 .B "#include <fenv.h>"
513 .BI "int feenableexcept(int " excepts );
515 .BI "int fedisableexcept(int " excepts );
517 .B "int fegetexcept(void);"
522 .\"O .BR feenableexcept ()
524 .\"O .BR fedisableexcept ()
525 .\"O functions enable (disable) traps for each of the exceptions represented by
527 .\"O and return the previous set of enabled exceptions when successful,
528 .\"O and \-1 otherwise.
530 .\"O .BR fegetexcept ()
531 .\"O function returns the set of all currently enabled exceptions.
532 .BR feenableexcept ()
534 .BR fedisableexcept ()
537 ¤Ë¤è¤Ã¤Æɽ¸½¤µ¤ì¤ë³ÆÎã³°¤Î¥È¥é¥Ã¥×¤ò͸ú (̵¸ú) ¤Ë¤¹¤ë¡£
538 À®¸ù¤·¤¿¾ì¹ç¤ÏľÁ°¤Ë͸ú¤Ë¤Ê¤Ã¤Æ¤¤¤¿Îã³°¤Î¥»¥Ã¥È¤òÊÖ¤¹¡£
539 ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï \-1 ¤òÊÖ¤¹¡£
541 ´Ø¿ô¤Ï¸½ºß͸ú¤Ë¤Ê¤Ã¤Æ¤¤¤ëÎã³°Á´¤Æ¤«¤é¤Ê¤ë¥»¥Ã¥È¤òÊÖ¤¹¡£
544 .\"O C99 specifies that the value of
546 .\"O should reflect changes to the current rounding mode, as set by
547 .\"O .BR fesetround ().
552 ¤ÇÀßÄꤵ¤ì¤¿¸½ºß¤Î´Ý¤á¥â¡¼¥É¤¬È¿±Ç¤µ¤ì¤ë¤Ù¤¤Ç¤¢¤ë¤È¤µ¤ì¤Æ¤¤¤ë¡£
555 .\" Aug 08, glibc 2.8
556 .\"O this does not occur:
558 .\"O always has the value 1.
559 ¤³¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤ª¤é¤º¡¢
562 .\" See http://gcc.gnu.org/ml/gcc/2002-02/msg01535.html