We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a828eb1 commit 1bcb9a5Copy full SHA for 1bcb9a5
2 files changed
source/mir/bignum/decimal.d
@@ -981,7 +981,8 @@ struct Decimal(size_t maxSize64)
981
ref opOpAssign(string op, size_t rhsMaxSize64)(ref const Decimal!rhsMaxSize64 rhs) @safe pure return
982
if (op == "+" || op == "-")
983
{
984
- BigInt!rhsMaxSize64 rhsCopy;
+ import mir.utility: max;
985
+ BigInt!(max(rhsMaxSize64, maxSize64, 256u)) rhsCopy = void;
986
BigIntView!(const size_t) rhsView;
987
auto expDiff = exponent - rhs.exponent;
988
if (expDiff >= 0)
source/mir/math/sum.d
@@ -38,6 +38,8 @@ unittest
38
assert(ar.sum!"kbn" == 0.7000000000000455);
39
assert(ar.sum!"kb2" == 0.7000000000000455);
40
assert(ar.sum!"precise" == 0.7000000000000455);
41
+
42
+ assert([1e-20, 1].sum!"decimal" == 1);
43
}
44
45
///
0 commit comments