Skip to content

Commit b3e988d

Browse files
committed
Explain decimal32_t specific operators
1 parent 27a1964 commit b3e988d

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

doc/modules/ROOT/pages/decimal32_t.adoc

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,17 @@ explicit BOOST_DECIMAL_CXX20_CONSTEXPR decimal32_t(Float val) noexcept;
129129
explicit BOOST_DECIMAL_CXX20_CONSTEXPR operator float() const noexcept;
130130
explicit BOOST_DECIMAL_CXX20_CONSTEXPR operator double() const noexcept;
131131
explicit BOOST_DECIMAL_CXX20_CONSTEXPR operator long double() const noexcept;
132+
133+
// If C++23 and <stdfloat> are available
134+
explicit constexpr operator std::float16_t() const noexcept;
135+
explicit constexpr operator std::float32_t() const noexcept;
136+
explicit constexpr operator std::float64_t() const noexcept;
137+
explicit constexpr operator std::bfloat16_t() const noexcept;
132138
----
133139

134140
See: xref:binary_floating_conversions.adoc[]
135141

136-
=== Construction from integral type
142+
=== Construction From Integral Type
137143

138144
[source,c++]
139145
----
@@ -144,7 +150,7 @@ explicit constexpr decimal32_t(Integer val) noexcept;
144150

145151
Constructs a decimal value subject to the current rounding mode (if necessary).
146152

147-
=== Construction from string
153+
=== Construction From String
148154

149155
[source,c++]
150156
----
@@ -170,7 +176,7 @@ Constructs a decimal value that matches `str` subject to:
170176
. On underflow constructs `0`
171177
. Rounds value represented by `str` according to current rounding mode
172178

173-
=== Conversion to integral type
179+
=== Conversion to Integral Type
174180

175181
[source,c++]
176182
----
@@ -190,7 +196,7 @@ Constructs an integer representation of the decimal value subject to:
190196
. If the decimal value is `NAN` returns `std::numeric_limits<IntegerType>::max()`
191197
. If the decimal value exceeds the range of the `IntegerType` returns `std::numeric_limits<IntegerType>::max()`
192198

193-
=== Increment and Decrement operators
199+
=== Increment and Decrement Operators
194200

195201
[source,c++]
196202
----
@@ -219,3 +225,12 @@ constexpr decimal32_t& operator/=(RHS rhs);
219225

220226
Matches the behavior of xref:generic_decimal.adoc#operator_behavior[addition, subtraction, multiplication, and division].
221227

228+
=== Conversion to Other Decimal Types
229+
230+
[source,c++]
231+
----
232+
explicit constexpr operator decimal64_t() const noexcept;
233+
explicit constexpr operator decimal128_t() const noexcept;
234+
----
235+
236+
Losslessly converts the current decimal value to `decimal64_t` or `decimal128_t`.

0 commit comments

Comments
 (0)