aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-23 07:13:31 -0500
committerJack Lloyd <[email protected]>2018-02-23 07:13:31 -0500
commit971749b8486e4a17eba54c32a8fdff942eb37af2 (patch)
treec7a325814c8a7ceb861284acaffdb1e62d4a9bc0 /src/lib
parent1152261ca45a55f368ea31aa9a5eb89d9c35abc4 (diff)
Fix an error in BigInt operator-
(x) - (-x) would result in -2x instead of the correct 2x
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/math/bigint/big_ops3.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib/math/bigint/big_ops3.cpp b/src/lib/math/bigint/big_ops3.cpp
index eed8a29a0..680eca635 100644
--- a/src/lib/math/bigint/big_ops3.cpp
+++ b/src/lib/math/bigint/big_ops3.cpp
@@ -66,6 +66,7 @@ BigInt operator-(const BigInt& x, const BigInt& y)
{
if(x.sign() != y.sign())
bigint_shl2(z.mutable_data(), x.data(), x_sw, 0, 1);
+ z.set_sign(y.reverse_sign());
}
else if(relative_size > 0)
{