Skip to content

Commit 9162ea1

Browse files
committed
Add constructor behavior notes
1 parent de07d0a commit 9162ea1

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

doc/modules/ROOT/pages/decimal32_t.adoc

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public:
4646
// 3.2.2.1 construct/copy/destroy
4747
constexpr decimal32_t() noexcept = default;
4848
49-
// 3.2.2.2 Conversion form floating-point type
49+
// 3.2.2.2 Conversion from floating-point type
5050
template <typename Float>
5151
explicit BOOST_DECIMAL_CXX20_CONSTEXPR decimal32_t(Float val) noexcept;
5252
@@ -114,3 +114,53 @@ explicit constexpr operator decimal128_t() const noexcept;
114114
} //namespace boost
115115
116116
----
117+
118+
== Operator Behavior
119+
120+
=== Construction from binary floating-point type
121+
122+
[source, c++]
123+
----
124+
// 3.2.2.2 Conversion from floating-point type
125+
template <typename Float>
126+
explicit BOOST_DECIMAL_CXX20_CONSTEXPR decimal32_t(Float val) noexcept;
127+
----
128+
129+
See: xref:binary_floating_conversions.adoc[]
130+
131+
=== Construction from integral type
132+
133+
[source,c++]
134+
----
135+
// 3.2.2.3 Conversion from integral type
136+
template <typename Integer>
137+
explicit constexpr decimal32_t(Integer val) noexcept;
138+
----
139+
140+
Constructs a decimal value subject to the current rounding mode (if necessary).
141+
142+
=== Construction from string
143+
144+
[source,c++]
145+
----
146+
// Extension: Construction from (c)string
147+
explicit constexpr decimal32_t(const char* str);
148+
149+
#ifndef BOOST_DECIMAL_HAS_STD_STRING_VIEW
150+
explicit inline decimal32_t(const std::string& str);
151+
#else
152+
explicit constexpr decimal32_t(std::string_view str);
153+
#endif
154+
----
155+
156+
Constructs a decimal value that matches `str` subject to:
157+
158+
. If `str` is a `nullptr` or of length 0 either:
159+
.. `throw std::runtime_error`
160+
.. Constructs a `QNAN` in a no exception environment
161+
. If `str` is an invalid string either:
162+
.. `throw std::runtime_error`
163+
.. Constructs a `QNAN` in a no exception environment
164+
. On overflow constructs `INF`
165+
. On underflow constructs `0`
166+
. Rounds value represented by `str` according to current rounding mode

0 commit comments

Comments
 (0)