Skip to content

Commit 2db7193

Browse files
committed
Add addition behavior
1 parent 7f442a1 commit 2db7193

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

doc/modules/ROOT/pages/generic_decimal.adoc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,26 @@ constexpr decimal128_t operator-(decimal128_t rhs) noexcept;
189189
----
190190

191191
Returns negated `rhs` in all cases.
192+
193+
=== Addition
194+
195+
[source,c++]
196+
----
197+
// 3.2.8 binary arithmetic operators:
198+
// LHS and RHS can be any integer or decimal type
199+
200+
constexpr /* see 3.2.8 */ operator+(LHS lhs, decimal32_t rhs) noexcept;
201+
constexpr /* see 3.2.8 */ operator+(LHS lhs, decimal64_t rhs) noexcept;
202+
constexpr /* see 3.2.8 */ operator+(LHS lhs, decimal128_t rhs) noexcept;
203+
constexpr /* see 3.2.8 */ operator+(decimal32_t lhs, RHS rhs) noexcept;
204+
constexpr /* see 3.2.8 */ operator+(decimal64_t lhs, RHS rhs) noexcept;
205+
constexpr /* see 3.2.8 */ operator+(decimal128_t lhs, RHS rhs) noexcept;
206+
----
207+
208+
Returns the result of `lhs + rhs` subject to:
209+
210+
. If either `lhs` or `rhs` are `NAN`, returns `QNAN`
211+
. If `lhs` and `rhs` are `INF` of opposite sign, returns `QNAN`
212+
. If either `lhs` or `rhs` are `INF`, returns `INF` of same sign
213+
. If `lhs + rhs` overflows, returns `INF`
214+
. If `lhs + rhs` underflows, returns `0`

0 commit comments

Comments
 (0)