Skip to content

Commit 9be7d4e

Browse files
committed
Add subtraction behavior
1 parent 2db7193 commit 9be7d4e

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
@@ -212,3 +212,26 @@ Returns the result of `lhs + rhs` subject to:
212212
. If either `lhs` or `rhs` are `INF`, returns `INF` of same sign
213213
. If `lhs + rhs` overflows, returns `INF`
214214
. If `lhs + rhs` underflows, returns `0`
215+
216+
=== Subtraction
217+
218+
[source,c++]
219+
----
220+
// 3.2.8 binary arithmetic operators:
221+
// LHS and RHS can be any integer or decimal type
222+
223+
constexpr /* see 3.2.8 */ operator-(LHS lhs, decimal32_t rhs) noexcept;
224+
constexpr /* see 3.2.8 */ operator-(LHS lhs, decimal64_t rhs) noexcept;
225+
constexpr /* see 3.2.8 */ operator-(LHS lhs, decimal128_t rhs) noexcept;
226+
constexpr /* see 3.2.8 */ operator-(decimal32_t lhs, RHS rhs) noexcept;
227+
constexpr /* see 3.2.8 */ operator-(decimal64_t lhs, RHS rhs) noexcept;
228+
constexpr /* see 3.2.8 */ operator-(decimal128_t lhs, RHS rhs) noexcept;
229+
----
230+
231+
Returns the result of `lhs - rhs` subject to:
232+
233+
. If either `lhs` or `rhs` are `NAN`, returns `QNAN`
234+
. If `lhs` and `rhs` are `INF` of opposite sign, returns `QNAN`
235+
. If either `lhs` or `rhs` are `INF`, returns `INF` of same sign
236+
. If `lhs - rhs` overflows, returns `INF`
237+
. If `lhs - rhs` underflows, returns `0`

0 commit comments

Comments
 (0)