1fegetenv(3M) Mathematical Library Functions fegetenv(3M)
2
3
4
6 fegetenv, fesetenv - get and set current floating-point environment
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <fenv.h>
11
12 int fegetenv(fenv_t *envp);
13
14
15 int fesetenv(const fenv_t *envp);
16
17
19 The fegetenv() function attempts to store the current floating-point
20 environment in the object pointed to by envp.
21
22
23 The fesetenv() function attempts to establish the floating-point envi‐
24 ronment represented by the object pointed to by envp. The envp argument
25 points to an object set by a call to fegetenv() or feholdexcept(3M), or
26 equals a floating-point environment macro. The fesetenv() function does
27 not raise floating-point exceptions, but only installs the state of the
28 floating-point status flags represented through its argument.
29
31 If the representation was successfully stored, fegetenv returns 0. Oth‐
32 erwise, it returns a non-zero value.
33
34
35 If the environment was successfully established, fesetenv returns 0.
36 Otherwise, it returns a non-zero value.
37
39 No errors are defined.
40
42 See attributes(5) for descriptions of the following attributes:
43
44
45
46
47 ┌─────────────────────────────┬─────────────────────────────┐
48 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
49 ├─────────────────────────────┼─────────────────────────────┤
50 │Interface Stability │Standard │
51 ├─────────────────────────────┼─────────────────────────────┤
52 │MT-Level │MT-Safe │
53 └─────────────────────────────┴─────────────────────────────┘
54
56 feholdexcept(3M), fenv.h(3HEAD), feupdateenv(3M), attributes(5), stan‐
57 dards(5)
58
60 In a multithreaded program, the fegetenv() and fegetenv() functions
61 affect the floating point environment only for the calling thread.
62
63
64 These functions automatically install and deinstall SIGFPE handlers and
65 set and clear the trap enable mode bits in the floating point status
66 register as needed. If a program uses these functions and attempts to
67 install a SIGFPE handler or control the trap enable mode bits indepen‐
68 dently, the resulting behavior is not defined.
69
70
71 As described in fex_set_handling(3M), when a handling function
72 installed in FEX_CUSTOM mode is invoked, all exception traps are dis‐
73 abled (and will not be reenabled while SIGFPE is blocked). Thus,
74 attempting to change the environment from within a handler by calling
75 fesetenv or feupdateenv(3M) might not produce the expected results.
76
77
78
79SunOS 5.11 12 Jul 2006 fegetenv(3M)