1 .\" $OpenBSD: feclearexcept.3,v 1.4 2013/06/05 03:40:26 tedu Exp $
3 .\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: June 5 2013 $
26 .Nd access floating-point status flags
30 .Fn feclearexcept "int excepts"
32 .Fn fegetexceptflag "fexcept_t *flagp" "int excepts"
34 .Fn feraiseexcept "int excepts"
36 .Fn fesetexceptflag "const fexcept_t *flagp" "int excepts"
38 .Fn fetestexcept "int excepts"
40 These functions provide access to the floating-point status flags.
43 input argument is a bitmask specifying an exception type and
44 containing any of the values listed below.
45 .Bl -tag -width ".Dv FE_DIVBYZERO"
47 A divide-by-zero exception occurs when the program attempts to
48 divide a finite non-zero number by zero.
50 An inexact exception is raised whenever there is a loss of precision
53 Invalid operation exceptions occur when a program attempts to
54 perform calculations for which there is no reasonable representable
57 For instance, subtraction of infinities, division of zero by zero,
58 ordered comparison involving \*(Nas, and taking the square root of a
59 negative number are all invalid operations.
61 An overflow exception occurs when the magnitude of the result of a
62 computation is too large to fit in the destination type.
64 Underflow occurs when the result of a computation is too close to zero
65 to be represented as a non-zero value in the destination type.
67 Denormalization exception occurs when the result of a floating-point
68 expression is a denormalized number.
70 This is available only on the floating-point implementations of
71 amd64 and i386 processors.
74 Additionally, the macro
76 is simply the bitwise OR of all floating-point exception macros
81 function clears the floating-point exceptions represented by
86 function stores a representation of the states of the floating-point
89 in the object pointed to by
94 function raises floating-point exceptions represented by
99 function sets the floating-point status flags indicated by
101 to the states stored in the object pointed to by
105 shall have been set by a previous call to
107 whose second argument represented at least those floating-point
108 exceptions represented by
110 This function does not raise floating-point exceptions, but only
111 sets the state of the flags.
115 function determines which of a specified subset of the floating-point
116 exception flags are currently set.
119 specifies the floating-point status flags to be queried.
123 .Fn fegetexceptflag ,
127 functions return zero on success, and non-zero if an error occurred.
130 function returns a bitmask of a specified subset of the floating-point
131 exception flags which are currently set.
133 .Xr feenableexcept 3 ,
139 .Fn fegetexceptflag ,
141 .Fn fesetexceptflag ,
149 .Fn fegetexceptflag ,
159 These functions first appeared in
162 On some architectures,
164 additionally raises the
166 floating-point exception whenever it raises the
170 floating-point exception.