From Jason Turner

[cfenv]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpzbixfq2a/{from.md → to.md} +36 -27
tmp/tmpzbixfq2a/{from.md → to.md} RENAMED
@@ -1,60 +1,69 @@
1
  ## The floating-point environment <a id="cfenv">[[cfenv]]</a>
2
 
3
  ### Header `<cfenv>` synopsis <a id="cfenv.syn">[[cfenv.syn]]</a>
4
 
5
  ``` cpp
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  namespace std {
7
  // types
8
- typedef object type fenv_t;
9
- typedef integer type fexcept_t;
10
 
11
  // functions
12
  int feclearexcept(int except);
13
  int fegetexceptflag(fexcept_t* pflag, int except);
14
  int feraiseexcept(int except);
15
  int fesetexceptflag(const fexcept_t* pflag, int except);
16
  int fetestexcept(int except);
17
 
18
- int fegetround(void);
19
  int fesetround(int mode);
20
 
21
  int fegetenv(fenv_t* penv);
22
  int feholdexcept(fenv_t* penv);
23
  int fesetenv(const fenv_t* penv);
24
  int feupdateenv(const fenv_t* penv);
25
  }
26
  ```
27
 
28
- The header also defines the macros:
29
-
30
- ``` cpp
31
- FE_ALL_EXCEPT
32
- FE_DIVBYZERO
33
- FE_INEXACT
34
- FE_INVALID
35
- FE_OVERFLOW
36
- FE_UNDERFLOW
37
-
38
- FE_DOWNWARD
39
- FE_TONEAREST
40
- FE_TOWARDZERO
41
- FE_UPWARD
42
-
43
- FE_DFL_ENV
44
- ```
45
-
46
- The header defines all functions, types, and macros the same as Clause
47
- 7.6 of the C standard.
48
 
49
  The floating-point environment has thread storage duration (
50
  [[basic.stc.thread]]). The initial state for a thread’s floating-point
51
  environment is the state of the floating-point environment of the thread
52
- that constructs the corresponding `std::thread` object (
53
- [[thread.thread.class]]) at the time it constructed the object. That is,
54
- the child thread gets the floating-point state of the parent thread at
55
- the time of the child’s creation.
 
56
 
57
  A separate floating-point environment shall be maintained for each
58
  thread. Each function accesses the environment corresponding to its
59
  calling thread.
60
 
 
 
 
1
  ## The floating-point environment <a id="cfenv">[[cfenv]]</a>
2
 
3
  ### Header `<cfenv>` synopsis <a id="cfenv.syn">[[cfenv.syn]]</a>
4
 
5
  ``` cpp
6
+ #define FE_ALL_EXCEPT see below
7
+ #define FE_DIVBYZERO see below
8
+ #define FE_INEXACT see below
9
+ #define FE_INVALID see below
10
+ #define FE_OVERFLOW see below
11
+ #define FE_UNDERFLOW see below
12
+
13
+ #define FE_DOWNWARD see below
14
+ #define FE_TONEAREST see below
15
+ #define FE_TOWARDZERO see below
16
+ #define FE_UPWARD see below
17
+
18
+ #define FE_DFL_ENV see below
19
+
20
  namespace std {
21
  // types
22
+ using fenv_t = object type;
23
+ using fexcept_t = integer type;
24
 
25
  // functions
26
  int feclearexcept(int except);
27
  int fegetexceptflag(fexcept_t* pflag, int except);
28
  int feraiseexcept(int except);
29
  int fesetexceptflag(const fexcept_t* pflag, int except);
30
  int fetestexcept(int except);
31
 
32
+ int fegetround();
33
  int fesetround(int mode);
34
 
35
  int fegetenv(fenv_t* penv);
36
  int feholdexcept(fenv_t* penv);
37
  int fesetenv(const fenv_t* penv);
38
  int feupdateenv(const fenv_t* penv);
39
  }
40
  ```
41
 
42
+ The contents and meaning of the header `<cfenv>` are the same as the C
43
+ standard library header `<fenv.h>`.
44
+
45
+ [*Note 1*: This International Standard does not require an
46
+ implementation to support the `FENV_ACCESS` pragma; it is
47
+ *implementation-defined* ([[cpp.pragma]]) whether the pragma is
48
+ supported. As a consequence, it is *implementation-defined* whether
49
+ these functions can be used to test floating-point status flags, set
50
+ floating-point control modes, or run under non-default mode settings. If
51
+ the pragma is used to enable control over the floating-point
52
+ environment, this International Standard does not specify the effect on
53
+ floating-point evaluation in constant expressions. — *end note*]
 
 
 
 
 
 
 
 
54
 
55
  The floating-point environment has thread storage duration (
56
  [[basic.stc.thread]]). The initial state for a thread’s floating-point
57
  environment is the state of the floating-point environment of the thread
58
+ that constructs the corresponding `thread` object (
59
+ [[thread.thread.class]]) at the time it constructed the object.
60
+
61
+ [*Note 2*: That is, the child thread gets the floating-point state of
62
+ the parent thread at the time of the child’s creation. — *end note*]
63
 
64
  A separate floating-point environment shall be maintained for each
65
  thread. Each function accesses the environment corresponding to its
66
  calling thread.
67
 
68
+ ISO C 7.6
69
+