```1`fetestexcept(3M)        Mathematical Library Functions        fetestexcept(3M)`
2
3
4
```

## NAME

```6`       fetestexcept - test floating-point exception flags`
7
```

## SYNOPSIS

```9`       c99 [ flag... ] file... -lm [ library... ]`
10`       #include <fenv.h>`
11
12`       int fetestexcept(int excepts);`
13
14
```

## DESCRIPTION

```16`       The  fetestexcept()  function determines which of a specified subset of`
17`       the floating-point exception flags are currently set. The excepts argu‐`
18`       ment specifies the floating-point status flags to be queried.`
19
```

## RETURN VALUES

```21`       The  fetestexcept() function returns the value of the bitwise-inclusive`
22`       OR of the floating-point exception macros  corresponding  to  the  cur‐`
23`       rently set floating-point exceptions included in excepts.`
24
```

## ERRORS

```26`       No errors are defined.`
27
```

## EXAMPLES

```29`       Example 1 Example using fetestexcept()`
30
31
32`       The  following  example  calls function f( ) if an invalid exception is`
33`       set, and then function g( ) if an overflow exception is set:`
34
35
36`         #include <fenv.h>`
37`         /* ... */`
38`         {`
39`         #     pragma STDC FENV_ACCESS ON`
40`               int set_excepts;`
41`               feclearexcept(FE_INVALID | FE_OVERFLOW);`
42`               // maybe raise exceptions`
43`               set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);`
44`               if (set_excepts & FE_INVALID) f();`
45`               if (set_excepts & FE_OVERFLOW) g();`
46`               /* ... */`
47`         }`
48
49
```

## ATTRIBUTES

```51`       See attributes(5) for descriptions of the following attributes:`
52
53
54
55
56`       ┌─────────────────────────────┬─────────────────────────────┐`
57`       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │`
58`       ├─────────────────────────────┼─────────────────────────────┤`
59`       │Interface Stability          │Standard                     │`
60`       ├─────────────────────────────┼─────────────────────────────┤`
61`       │MT-Level                     │MT-Safe                      │`
62`       └─────────────────────────────┴─────────────────────────────┘`
63
```

## SEE ALSO

```65`       feclearexcept(3M), fegetexceptflag(3M),  fenv.h(3HEAD),  attributes(5),`
66`       standards(5)`
67
68
69
70`SunOS 5.11                        12 Jul 2006                 fetestexcept(3M)`
```