From Jason Turner

[atomics.types.float]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpc_s_c8j5/{from.md → to.md} +45 -45
tmp/tmpc_s_c8j5/{from.md → to.md} RENAMED
@@ -1,75 +1,75 @@
1
- ### Specializations for floating-point types <a id="atomics.types.float">[[atomics.types.float]]</a>
2
 
3
- There are specializations of the `atomic` class template for the
4
- floating-point types `float`, `double`, and `long double`. For each such
5
- type `floating-point`, the specialization `atomic<floating-point>`
6
  provides additional atomic operations appropriate to floating-point
7
  types.
8
 
9
  ``` cpp
10
  namespace std {
11
- template<> struct atomic<floating-point> {
12
- using value_type = floating-point;
13
  using difference_type = value_type;
14
 
15
  static constexpr bool is_always_lock_free = implementation-defined // whether a given atomic type's operations are always lock free;
16
  bool is_lock_free() const volatile noexcept;
17
  bool is_lock_free() const noexcept;
18
 
19
  constexpr atomic() noexcept;
20
- constexpr atomic(floating-point) noexcept;
21
  atomic(const atomic&) = delete;
22
  atomic& operator=(const atomic&) = delete;
23
  atomic& operator=(const atomic&) volatile = delete;
24
 
25
- void store(floating-point, memory_order = memory_order::seq_cst) volatile noexcept;
26
- void store(floating-point, memory_order = memory_order::seq_cst) noexcept;
27
- floating-point operator=(floating-point) volatile noexcept;
28
- floating-point operator=(floating-point) noexcept;
29
- floating-point load(memory_order = memory_order::seq_cst) volatile noexcept;
30
- floating-point load(memory_order = memory_order::seq_cst) noexcept;
31
- operator floating-point() volatile noexcept;
32
- operator floating-point() noexcept;
33
 
34
- floating-point exchange(floating-point,
35
  memory_order = memory_order::seq_cst) volatile noexcept;
36
- floating-point exchange(floating-point,
37
  memory_order = memory_order::seq_cst) noexcept;
38
- bool compare_exchange_weak(floating-point&, floating-point,
39
  memory_order, memory_order) volatile noexcept;
40
- bool compare_exchange_weak(floating-point&, floating-point,
41
  memory_order, memory_order) noexcept;
42
- bool compare_exchange_strong(floating-point&, floating-point,
43
  memory_order, memory_order) volatile noexcept;
44
- bool compare_exchange_strong(floating-point&, floating-point,
45
  memory_order, memory_order) noexcept;
46
- bool compare_exchange_weak(floating-point&, floating-point,
47
  memory_order = memory_order::seq_cst) volatile noexcept;
48
- bool compare_exchange_weak(floating-point&, floating-point,
49
  memory_order = memory_order::seq_cst) noexcept;
50
- bool compare_exchange_strong(floating-point&, floating-point,
51
  memory_order = memory_order::seq_cst) volatile noexcept;
52
- bool compare_exchange_strong(floating-point&, floating-point,
53
  memory_order = memory_order::seq_cst) noexcept;
54
 
55
- floating-point fetch_add(floating-point,
56
  memory_order = memory_order::seq_cst) volatile noexcept;
57
- floating-point fetch_add(floating-point,
58
  memory_order = memory_order::seq_cst) noexcept;
59
- floating-point fetch_sub(floating-point,
60
  memory_order = memory_order::seq_cst) volatile noexcept;
61
- floating-point fetch_sub(floating-point,
62
  memory_order = memory_order::seq_cst) noexcept;
63
 
64
- floating-point operator+=(floating-point) volatile noexcept;
65
- floating-point operator+=(floating-point) noexcept;
66
- floating-point operator-=(floating-point) volatile noexcept;
67
- floating-point operator-=(floating-point) noexcept;
68
 
69
- void wait(floating-point, memory_order = memory_order::seq_cst) const volatile noexcept;
70
- void wait(floating-point, 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
  };
@@ -81,12 +81,12 @@ They each have a trivial destructor.
81
 
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 key, operator, and computation correspondence are
87
- identified 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
  ```
@@ -104,15 +104,15 @@ operations [[intro.multithread]].
104
  the effects.
105
 
106
  *Remarks:* If the result is not a representable value for its
107
  type [[expr.pre]] the result is unspecified, but the operations
108
  otherwise have no undefined behavior. Atomic arithmetic operations on
109
- *`floating-point`* should conform to the
110
- `std::numeric_limits<`*`floating-point`*`>` traits associated with the
111
- floating-point type [[limits.syn]]. The floating-point
112
  environment [[cfenv]] for atomic arithmetic operations on
113
- *`floating-point`* 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;
@@ -125,12 +125,12 @@ T operator op=(T operand) noexcept;
125
  `return fetch_`*`key`*`(operand) `*`op`*` operand;`
126
 
127
  *Remarks:* If the result is not a representable value for its
128
  type [[expr.pre]] the result is unspecified, but the operations
129
  otherwise have no undefined behavior. Atomic arithmetic operations on
130
- *`floating-point`* should conform to the
131
- `std::numeric_limits<`*`floating-point`*`>` traits associated with the
132
- floating-point type [[limits.syn]]. The floating-point
133
  environment [[cfenv]] for atomic arithmetic operations on
134
- *`floating-point`* may be different than the calling thread’s
135
  floating-point environment.
136
 
 
1
+ #### Specializations for floating-point types <a id="atomics.types.float">[[atomics.types.float]]</a>
2
 
3
+ There are specializations of the `atomic` class template for all
4
+ cv-unqualified floating-point types. For each such type
5
+ `floating-point-type`, the specialization `atomic<floating-point-type>`
6
  provides additional atomic operations appropriate to floating-point
7
  types.
8
 
9
  ``` cpp
10
  namespace std {
11
+ template<> struct atomic<floating-point-type> {
12
+ using value_type = floating-point-type;
13
  using difference_type = value_type;
14
 
15
  static constexpr bool is_always_lock_free = implementation-defined // whether a given atomic type's operations are always lock free;
16
  bool is_lock_free() const volatile noexcept;
17
  bool is_lock_free() const noexcept;
18
 
19
  constexpr atomic() noexcept;
20
+ constexpr atomic(floating-point-type) noexcept;
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
  };
 
81
 
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
  ```
 
104
  the effects.
105
 
106
  *Remarks:* If the result is not a representable value for its
107
  type [[expr.pre]] the result is unspecified, but the operations
108
  otherwise have no undefined behavior. Atomic arithmetic operations on
109
+ *`floating-point-type`* should conform to the
110
+ `std::numeric_limits<`*`floating-point-type`*`>` traits associated with
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;
 
125
  `return fetch_`*`key`*`(operand) `*`op`*` operand;`
126
 
127
  *Remarks:* If the result is not a representable value for its
128
  type [[expr.pre]] the result is unspecified, but the operations
129
  otherwise have no undefined behavior. Atomic arithmetic operations on
130
+ *`floating-point-type`* should conform to the
131
+ `std::numeric_limits<`*`floating-point-type`*`>` traits associated with
132
+ the floating-point type [[limits.syn]]. The floating-point
133
  environment [[cfenv]] for atomic arithmetic operations on
134
+ *`floating-point-type`* may be different than the calling thread’s
135
  floating-point environment.
136