1 .\" $NetBSD: feclearexcept.3,v 1.2 2010/08/07 18:13:12 wiz Exp $
2 .\" Copyright (c) 2004 David Schultz <das@FreeBSD.org>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .Nd floating-point exception flag manipulation
40 .Fd "#pragma STDC FENV_ACCESS ON"
42 .Fn feclearexcept "int excepts"
44 .Fn fegetexceptflag "fexcept_t *flagp" "int excepts"
46 .Fn feraiseexcept "int excepts"
48 .Fn fesetexceptflag "const fexcept_t *flagp" "int excepts"
50 .Fn fetestexcept "int excepts"
54 routine clears the floating-point exception flags specified by
58 raises the specified exceptions.
59 Raising an exception causes the corresponding flag to be set,
62 is delivered to the process if the exception is unmasked.
66 function determines which flags are currently set, of those specified by
71 function stores the state of the exception flags specified in
73 in the opaque object pointed to by
77 changes the specified exception flags to reflect the state stored in
78 the object pointed to by
80 Note that the flags restored with
82 must be a (not necessarily proper) subset of the flags recorded by
86 For all of these functions, the possible types of exceptions
87 include those described in
89 Some architectures may define other types of floating-point exceptions.
90 .Sh IMPLEMENTATION NOTES
91 On some architectures, raising an overflow or underflow exception
92 also causes an inexact exception to be raised.
93 In these cases, the overflow or underflow will be raised first.
99 routines are preferred to
103 respectively, for saving and restoring exception flags.
104 The latter do not re-raise exceptions and may preserve
105 architecture-specific information such as addresses where
110 .Fn fegetexceptflag ,
114 functions return 0 upon success, and non-zero otherwise.
117 function returns the bitwise OR of the values of the current exception
118 flags that were requested.
128 .Fn fegetexceptflag ,
130 .Fn fesetexceptflag ,
136 These functions first appeared in