From Jason Turner

[atomics.types.float]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpue02dke5/{from.md → to.md} +136 -0
tmp/tmpue02dke5/{from.md → to.md} RENAMED
@@ -0,0 +1,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 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
+ };
76
+ }
77
+ ```
78
+
79
+ The atomic floating-point specializations are standard-layout structs.
80
+ 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
+ ```
93
+
94
+ *Constraints:* For the `volatile` overload of this function,
95
+ `is_always_lock_free` is `true`.
96
+
97
+ *Effects:* Atomically replaces the value pointed to by `this` with the
98
+ result of the computation applied to the value pointed to by `this` and
99
+ the given `operand`. Memory is affected according to the value of
100
+ `order`. These operations are atomic read-modify-write
101
+ operations [[intro.multithread]].
102
+
103
+ *Returns:* Atomically, the value pointed to by `this` immediately before
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;
119
+ ```
120
+
121
+ *Constraints:* For the `volatile` overload of this function,
122
+ `is_always_lock_free` is `true`.
123
+
124
+ *Effects:* Equivalent to:
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
+