Skip to content

Commit b6ef45f

Browse files
committed
Fix regression in the not pure power of 10 case
1 parent bed71c5 commit b6ef45f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/boost/decimal/detail/add_impl.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ constexpr auto add_impl(const T& lhs, const T& rhs) noexcept -> ReturnType
8282
big_lhs += 9U;
8383
--lhs_exp;
8484
}
85+
else
86+
{
87+
--big_lhs;
88+
}
8589

8690
return ReturnType{big_lhs, lhs_exp, lhs.isneg()};
8791
}
@@ -95,6 +99,10 @@ constexpr auto add_impl(const T& lhs, const T& rhs) noexcept -> ReturnType
9599
big_rhs += 9U;
96100
--rhs_exp;
97101
}
102+
else
103+
{
104+
--big_rhs;
105+
}
98106

99107
return ReturnType{big_rhs, rhs_exp, rhs.isneg()};
100108
}
@@ -186,6 +194,10 @@ constexpr auto d128_add_impl(T lhs_sig, U lhs_exp, bool lhs_sign,
186194
lhs_sig += 9U;
187195
--lhs_exp;
188196
}
197+
else
198+
{
199+
--lhs_sig;
200+
}
189201

190202
return ReturnType{lhs_sig, lhs_exp, lhs_sign};
191203
}
@@ -199,6 +211,10 @@ constexpr auto d128_add_impl(T lhs_sig, U lhs_exp, bool lhs_sign,
199211
rhs_sig += 9U;
200212
--rhs_exp;
201213
}
214+
else
215+
{
216+
--rhs_sig;
217+
}
202218

203219
return ReturnType{rhs_sig, rhs_exp, rhs_sign};
204220
}

0 commit comments

Comments
 (0)