From Jason Turner

[atomics.types.float]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0fix53k5/{from.md → to.md} +162 -21
tmp/tmp0fix53k5/{from.md → to.md} RENAMED
@@ -21,59 +21,117 @@ namespace std {
21
  atomic(const atomic&) = delete;
22
  atomic& operator=(const atomic&) = delete;
23
  atomic& operator=(const atomic&) volatile = delete;
24
 
25
  void store(floating-point-type, memory_order = memory_order::seq_cst) volatile noexcept;
26
- void store(floating-point-type, memory_order = memory_order::seq_cst) noexcept;
27
  floating-point-type operator=(floating-point-type) volatile noexcept;
28
- floating-point-type operator=(floating-point-type) noexcept;
29
  floating-point-type load(memory_order = memory_order::seq_cst) volatile noexcept;
30
- floating-point-type load(memory_order = memory_order::seq_cst) noexcept;
31
  operator floating-point-type() volatile noexcept;
32
- operator floating-point-type() noexcept;
33
 
34
  floating-point-type exchange(floating-point-type,
35
  memory_order = memory_order::seq_cst) volatile noexcept;
36
- floating-point-type exchange(floating-point-type,
37
  memory_order = memory_order::seq_cst) noexcept;
38
  bool compare_exchange_weak(floating-point-type&, floating-point-type,
39
  memory_order, memory_order) volatile noexcept;
40
- bool compare_exchange_weak(floating-point-type&, floating-point-type,
41
  memory_order, memory_order) noexcept;
42
  bool compare_exchange_strong(floating-point-type&, floating-point-type,
43
  memory_order, memory_order) volatile noexcept;
44
- bool compare_exchange_strong(floating-point-type&, floating-point-type,
45
  memory_order, memory_order) noexcept;
46
  bool compare_exchange_weak(floating-point-type&, floating-point-type,
47
  memory_order = memory_order::seq_cst) volatile noexcept;
48
- bool compare_exchange_weak(floating-point-type&, floating-point-type,
49
  memory_order = memory_order::seq_cst) noexcept;
50
  bool compare_exchange_strong(floating-point-type&, floating-point-type,
51
  memory_order = memory_order::seq_cst) volatile noexcept;
52
- bool compare_exchange_strong(floating-point-type&, floating-point-type,
53
  memory_order = memory_order::seq_cst) noexcept;
54
 
55
  floating-point-type fetch_add(floating-point-type,
56
  memory_order = memory_order::seq_cst) volatile noexcept;
57
- floating-point-type fetch_add(floating-point-type,
58
  memory_order = memory_order::seq_cst) noexcept;
59
  floating-point-type fetch_sub(floating-point-type,
60
  memory_order = memory_order::seq_cst) volatile noexcept;
61
- floating-point-type fetch_sub(floating-point-type,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  memory_order = memory_order::seq_cst) noexcept;
63
 
64
  floating-point-type operator+=(floating-point-type) volatile noexcept;
65
- floating-point-type operator+=(floating-point-type) noexcept;
66
  floating-point-type operator-=(floating-point-type) volatile noexcept;
67
- floating-point-type operator-=(floating-point-type) noexcept;
68
 
69
  void wait(floating-point-type, memory_order = memory_order::seq_cst) const volatile noexcept;
70
- void wait(floating-point-type, memory_order = memory_order::seq_cst) const noexcept;
 
71
  void notify_one() volatile noexcept;
72
- void notify_one() noexcept;
73
  void notify_all() volatile noexcept;
74
- void notify_all() noexcept;
75
  };
76
  }
77
  ```
78
 
79
  The atomic floating-point specializations are standard-layout structs.
@@ -82,15 +140,19 @@ They each have a trivial destructor.
82
  Descriptions are provided below only for members that differ from the
83
  primary template.
84
 
85
  The following operations perform arithmetic addition and subtraction
86
  computations. The correspondence among key, operator, and computation is
87
- specified in [[atomic.types.int.comp]].
 
 
88
 
89
  ``` cpp
90
- T fetch_key(T operand, memory_order order = memory_order::seq_cst) volatile noexcept;
91
- T fetch_key(T operand, memory_order order = memory_order::seq_cst) noexcept;
 
 
92
  ```
93
 
94
  *Constraints:* For the `volatile` overload of this function,
95
  `is_always_lock_free` is `true`.
96
 
@@ -111,13 +173,92 @@ otherwise have no undefined behavior. Atomic arithmetic operations on
111
  the floating-point type [[limits.syn]]. The floating-point
112
  environment [[cfenv]] for atomic arithmetic operations on
113
  *`floating-point-type`* may be different than the calling thread’s
114
  floating-point environment.
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  ``` cpp
117
- T operator op=(T operand) volatile noexcept;
118
- T operator op=(T operand) noexcept;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  ```
120
 
121
  *Constraints:* For the `volatile` overload of this function,
122
  `is_always_lock_free` is `true`.
123
 
 
21
  atomic(const atomic&) = delete;
22
  atomic& operator=(const atomic&) = delete;
23
  atomic& operator=(const atomic&) volatile = delete;
24
 
25
  void store(floating-point-type, memory_order = memory_order::seq_cst) volatile noexcept;
26
+ constexpr void store(floating-point-type, memory_order = memory_order::seq_cst) noexcept;
27
  floating-point-type operator=(floating-point-type) volatile noexcept;
28
+ constexpr floating-point-type operator=(floating-point-type) noexcept;
29
  floating-point-type load(memory_order = memory_order::seq_cst) volatile noexcept;
30
+ constexpr floating-point-type load(memory_order = memory_order::seq_cst) noexcept;
31
  operator floating-point-type() volatile noexcept;
32
+ constexpr operator floating-point-type() noexcept;
33
 
34
  floating-point-type exchange(floating-point-type,
35
  memory_order = memory_order::seq_cst) volatile noexcept;
36
+ constexpr floating-point-type exchange(floating-point-type,
37
  memory_order = memory_order::seq_cst) noexcept;
38
  bool compare_exchange_weak(floating-point-type&, floating-point-type,
39
  memory_order, memory_order) volatile noexcept;
40
+ constexpr bool compare_exchange_weak(floating-point-type&, floating-point-type,
41
  memory_order, memory_order) noexcept;
42
  bool compare_exchange_strong(floating-point-type&, floating-point-type,
43
  memory_order, memory_order) volatile noexcept;
44
+ constexpr bool compare_exchange_strong(floating-point-type&, floating-point-type,
45
  memory_order, memory_order) noexcept;
46
  bool compare_exchange_weak(floating-point-type&, floating-point-type,
47
  memory_order = memory_order::seq_cst) volatile noexcept;
48
+ constexpr bool compare_exchange_weak(floating-point-type&, floating-point-type,
49
  memory_order = memory_order::seq_cst) noexcept;
50
  bool compare_exchange_strong(floating-point-type&, floating-point-type,
51
  memory_order = memory_order::seq_cst) volatile noexcept;
52
+ constexpr bool compare_exchange_strong(floating-point-type&, floating-point-type,
53
  memory_order = memory_order::seq_cst) noexcept;
54
 
55
  floating-point-type fetch_add(floating-point-type,
56
  memory_order = memory_order::seq_cst) volatile noexcept;
57
+ constexpr floating-point-type fetch_add(floating-point-type,
58
  memory_order = memory_order::seq_cst) noexcept;
59
  floating-point-type fetch_sub(floating-point-type,
60
  memory_order = memory_order::seq_cst) volatile noexcept;
61
+ constexpr floating-point-type fetch_sub(floating-point-type,
62
+ memory_order = memory_order::seq_cst) noexcept;
63
+ floating-point-type fetch_max(floating-point-type,
64
+ memory_order = memory_order::seq_cst) volatile noexcept;
65
+ constexpr floating-point-type fetch_max(floating-point-type,
66
+ memory_order = memory_order::seq_cst) noexcept;
67
+ floating-point-type fetch_min(floating-point-type,
68
+ memory_order = memory_order::seq_cst) volatile noexcept;
69
+ constexpr floating-poin-typet fetch_min(floating-point-type,
70
+ memory_order = memory_order::seq_cst) noexcept;
71
+ floating-point-type fetch_fmaximum(floating-point-type,
72
+ memory_order = memory_order::seq_cst) volatile noexcept;
73
+ constexpr floating-point-type fetch_fmaximum(floating-point-type,
74
+ memory_order = memory_order::seq_cst) noexcept;
75
+ floating-point-type fetch_fminimum(floating-point-type,
76
+ memory_order = memory_order::seq_cst) volatile noexcept;
77
+ constexpr floating-point-type fetch_fminimum(floating-point-type,
78
+ memory_order = memory_order::seq_cst) noexcept;
79
+ floating-point-type fetch_fmaximum_num(
80
+ floating-point-type, memory_order = memory_order::seq_cst) volatile noexcept;
81
+ constexpr floating-point-type fetch_fmaximum_num(
82
+ floating-point-type, memory_order = memory_order::seq_cst) noexcept;
83
+ floating-point-type fetch_fminimum_num(
84
+ floating-point-type, memory_order = memory_order::seq_cst) volatile noexcept;
85
+ constexpr floating-point-type fetch_fminimum_num(
86
+ floating-point-type, memory_order = memory_order::seq_cst) noexcept;
87
+
88
+ void store_add(floating-point-type,
89
+ memory_order = memory_order::seq_cst) volatile noexcept;
90
+ constexpr void store_add(floating-point-type,
91
+ memory_order = memory_order::seq_cst) noexcept;
92
+ void store_sub(floating-point-type,
93
+ memory_order = memory_order::seq_cst) volatile noexcept;
94
+ constexpr void store_sub(floating-point-type,
95
+ memory_order = memory_order::seq_cst) noexcept;
96
+ void store_max(floating-point-type,
97
+ memory_order = memory_order::seq_cst) volatile noexcept;
98
+ constexpr void store_max(floating-point-type,
99
+ memory_order = memory_order::seq_cst) noexcept;
100
+ void store_min(floating-point-type,
101
+ memory_order = memory_order::seq_cst) volatile noexcept;
102
+ constexpr void store_min(floating-point-type,
103
+ memory_order = memory_order::seq_cst) noexcept;
104
+ void store_fmaximum(floating-point-type,
105
+ memory_order = memory_order::seq_cst) volatile noexcept;
106
+ constexpr void store_fmaximum(floating-point-type,
107
+ memory_order = memory_order::seq_cst) noexcept;
108
+ void store_fminimum(floating-point-type,
109
+ memory_order = memory_order::seq_cst) volatile noexcept;
110
+ constexpr void store_fminimum(floating-point-type,
111
+ memory_order = memory_order::seq_cst) noexcept;
112
+ void store_fmaximum_num(floating-point-type,
113
+ memory_order = memory_order::seq_cst) volatile noexcept;
114
+ constexpr void store_fmaximum_num(floating-point-type,
115
+ memory_order = memory_order::seq_cst) noexcept;
116
+ void store_fminimum_num(floating-point-type,
117
+ memory_order = memory_order::seq_cst) volatile noexcept;
118
+ constexpr void store_fminimum_num(floating-point-type,
119
  memory_order = memory_order::seq_cst) noexcept;
120
 
121
  floating-point-type operator+=(floating-point-type) volatile noexcept;
122
+ constexpr floating-point-type operator+=(floating-point-type) noexcept;
123
  floating-point-type operator-=(floating-point-type) volatile noexcept;
124
+ constexpr floating-point-type operator-=(floating-point-type) noexcept;
125
 
126
  void wait(floating-point-type, memory_order = memory_order::seq_cst) const volatile noexcept;
127
+ constexpr void wait(floating-point-type,
128
+ memory_order = memory_order::seq_cst) const noexcept;
129
  void notify_one() volatile noexcept;
130
+ constexpr void notify_one() noexcept;
131
  void notify_all() volatile noexcept;
132
+ constexpr void notify_all() noexcept;
133
  };
134
  }
135
  ```
136
 
137
  The atomic floating-point specializations are standard-layout structs.
 
140
  Descriptions are provided below only for members that differ from the
141
  primary template.
142
 
143
  The following operations perform arithmetic addition and subtraction
144
  computations. The correspondence among key, operator, and computation is
145
+ specified in [[atomic.types.int.comp]], except for the keys `max`,
146
+ `min`, `fmaximum`, `fminimum`, `fmaximum_num`, and `fminimum_num`, which
147
+ are specified below.
148
 
149
  ``` cpp
150
+ floating-point-type fetch_key(floating-point-type operand,
151
+ memory_order order = memory_order::seq_cst) volatile noexcept;
152
+ constexpr floating-point-type fetch_key(floating-point-type operand,
153
+ memory_order order = memory_order::seq_cst) noexcept;
154
  ```
155
 
156
  *Constraints:* For the `volatile` overload of this function,
157
  `is_always_lock_free` is `true`.
158
 
 
173
  the floating-point type [[limits.syn]]. The floating-point
174
  environment [[cfenv]] for atomic arithmetic operations on
175
  *`floating-point-type`* may be different than the calling thread’s
176
  floating-point environment.
177
 
178
+ - For `fetch_fmaximum` and `fetch_fminimum`, the maximum and minimum
179
+ computation is performed as if by `fmaximum` and `fminimum`,
180
+ respectively, with the value pointed to by `this` and the first
181
+ parameter as the arguments.
182
+ - For `fetch_fmaximum_num` and `fetch_fminimum_num`, the maximum and
183
+ minimum computation is performed as if by `fmaximum_num` and
184
+ `fminimum_num`, respectively, with the value pointed to by `this` and
185
+ the first parameter as the arguments.
186
+ - For `fetch_max` and `fetch_min`, the maximum and minimum computation
187
+ is performed as if by `fmaximum_num` and `fminimum_num`, respectively,
188
+ with the value pointed to by `this` and the first parameter as the
189
+ arguments, except that:
190
+ - If both arguments are NaN, an unspecified NaN value replaces the
191
+ value pointed to by `this`.
192
+ - If exactly one argument is a NaN, either the other argument or an
193
+ unspecified NaN value replaces the value pointed to by `this`; it is
194
+ unspecified which.
195
+ - If the arguments are differently signed zeros, which of these values
196
+ replaces the value pointed to by this is unspecified.
197
+
198
+ *Recommended practice:* The implementation of `fetch_max` and
199
+ `fetch_min` should treat negative zero as smaller than positive zero.
200
+
201
  ``` cpp
202
+ void store_key(floating-point-type operand,
203
+ memory_order order = memory_order::seq_cst) volatile noexcept;
204
+ constexpr void store_key(floating-point-type operand,
205
+ memory_order order = memory_order::seq_cst) noexcept;
206
+ ```
207
+
208
+ *Constraints:* For the `volatile` overload of this function,
209
+ `is_always_lock_free` is `true`.
210
+
211
+ *Preconditions:* `order` is `memory_order::relaxed`,
212
+ `memory_order::release`, or `memory_order::seq_cst`.
213
+
214
+ *Effects:* Atomically replaces the value pointed to by `this` with the
215
+ result of the computation applied to the value pointed to by `this` and
216
+ the given operand. Memory is affected according to the value of `order`.
217
+ These operations are atomic modify-write operations [[atomics.order]].
218
+
219
+ *Remarks:* If the result is not a representable value for its
220
+ type [[expr.pre]] the result is unspecified, but the operations
221
+ otherwise have no undefined behavior. Atomic arithmetic operations on
222
+ *`floating-point-type`* should conform to the
223
+ `numeric_limits<`*`floating-point-type`*`>` traits associated with the
224
+ floating-point type [[limits.syn]]. The floating-point
225
+ environment [[cfenv]] for atomic arithmetic operations on
226
+ *`floating-point-type`* may be different than the calling thread’s
227
+ floating-point environment. The arithmetic rules of floating-point
228
+ atomic modify-write operations may be different from operations on
229
+ floating-point types or atomic floating-point types.
230
+
231
+ [*Note 1*: Tree reductions are permitted for atomic modify-write
232
+ operations. — *end note*]
233
+
234
+ - For `store_fmaximum` and `store_fminimum`, the maximum and minimum
235
+ computation is performed as if by `fmaximum` and `fminimum`,
236
+ respectively, with the value pointed to by `this` and the first
237
+ parameter as the arguments.
238
+ - For `store_fmaximum_num` and `store_fminimum_num`, the maximum and
239
+ minimum computation is performed as if by `fmaximum_num` and
240
+ `fminimum_num`, respectively, with the value pointed to by `this` and
241
+ the first parameter as the arguments.
242
+ - For `store_max` and `store_min`, the maximum and minimum computation
243
+ is performed as if by `fmaximum_num` and `fminimum_num`, respectively,
244
+ with the value pointed to by `this` and the first parameter as the
245
+ arguments, except that:
246
+ - If both arguments are NaN, an unspecified NaN value replaces the
247
+ value pointed to by `this`.
248
+ - If exactly one argument is a NaN, either the other argument or an
249
+ unspecified NaN value replaces the value pointed to by `this`; it is
250
+ unspecified which.
251
+ - If the arguments are differently signed zeros, which of these values
252
+ replaces the value pointed to by `this` is unspecified.
253
+
254
+ *Recommended practice:* The implementation of `store_max` and
255
+ `store_min` should treat negative zero as smaller than positive zero.
256
+
257
+ ``` cpp
258
+ floating-point-type operator op=(floating-point-type operand) volatile noexcept;
259
+ constexpr floating-point-type operator op=(floating-point-type operand) noexcept;
260
  ```
261
 
262
  *Constraints:* For the `volatile` overload of this function,
263
  `is_always_lock_free` is `true`.
264