rtld - Support static TLS bindings for late-loaded shared libraries
[dragonfly.git] / contrib / openbsd_libm / man / fegetenv.3
1 .\"     $OpenBSD: fegetenv.3,v 1.3 2013/06/05 03:40:26 tedu Exp $
2 .\"
3 .\" Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
4 .\"
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.
8 .\"
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.
16 .\"
17 .Dd $Mdocdate: June 5 2013 $
18 .Dt FEGETENV 3
19 .Os
20 .Sh NAME
21 .Nm fegetenv ,
22 .Nm feholdexcept ,
23 .Nm fesetenv ,
24 .Nm feupdateenv
25 .Nd manage floating-point environment
26 .Sh SYNOPSIS
27 .In fenv.h
28 .Ft int
29 .Fn fegetenv "fenv_t *envp"
30 .Ft int
31 .Fn feholdexcept "fenv_t *envp"
32 .Ft int
33 .Fn fesetenv "const fenv_t *envp"
34 .Ft int
35 .Fn feupdateenv "const fenv_t *envp"
36 .Sh DESCRIPTION
37 These functions manage the floating-point environment -- status
38 flags, rounding direction modes and exception masks -- as one entity.
39 The
40 .Fa envp
41 input argument is an object representing the floating-point environment.
42 The macro
43 .Dv FE_DFL_ENV
44 represents the default floating-point environment -- the one installed
45 at program startup.
46 .Pp
47 The
48 .Fn fegetenv
49 function stores the current floating-point environment in the object
50 pointed to by
51 .Pa envp .
52 .Pp
53 The
54 .Fn feholdexcept
55 function saves the current floating-point environment in the object
56 pointed to by
57 .Pa envp ,
58 clears the floating-point status flags, and then installs a non-stop
59 (continue on floating-point exceptions) mode for all floating-point
60 exceptions.
61 .Pp
62 The
63 .Fn fesetenv
64 function establishes the floating-point environment represented by
65 the object pointed to by
66 .Pa envp .
67 The argument
68 .Pa envp
69 shall point to an object set by a call to
70 .Fn fegetenv
71 or
72 .Fn feholdexcept ,
73 or equal the macro
74 .Dv FE_DFL_ENV .
75 Note that
76 .Fn fesetenv
77 merely installs the state of the floating-point status flags
78 represented through its argument, and does not raise these
79 floating-point exceptions.
80 .Pp
81 The
82 .Fn feupdateenv
83 function saves the currently raised floating-point exceptions in
84 its automatic storage, installs the floating-point environment
85 represented by the object pointed to by
86 .Pa envp ,
87 and then raises the saved floating-point exceptions.
88 The argument
89 .Pa envp
90 shall point to an object set by a call to
91 .Fn feholdexcept
92 or
93 .Fn fegetenv ,
94 or equal the macro
95 .Dv FE_DFL_ENV .
96 .Sh RETURN VALUES
97 The
98 .Fn fegetenv ,
99 .Fn feholdexcept ,
100 .Fn fesetenv ,
101 and
102 .Fn feupdateenv
103 functions return zero on success, and non-zero if an error occurred.
104 .Sh SEE ALSO
105 .Xr feclearexcept 3 ,
106 .Xr feenableexcept 3 ,
107 .Xr fegetround 3
108 .Sh STANDARDS
109 The
110 .Fn fegetenv ,
111 .Fn feholdexcept ,
112 .Fn fesetenv ,
113 and
114 .Fn feupdateenv
115 functions conform to
116 .St -isoC-99 .
117 .Pp
118 The return types for
119 .Fn fegetenv ,
120 .Fn fesetenv ,
121 and
122 .Fn feupdateenv
123 are
124 .Vt int
125 for alignment with
126 .St -isoC-99
127 Defect Report #202.