Skip to content

Commit 2ad7574

Browse files
committed
Fix decimal128 0 comp
1 parent 9aa0d2d commit 2ad7574

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/boost/decimal/detail/comparison.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,11 @@ constexpr auto equal_parts_impl(T1 lhs_sig, U1 lhs_exp, bool lhs_sign,
9797

9898
// Check the value of delta exp to avoid to large a value for pow10
9999
// Also if only one of the significands is 0 then we know the values have to be mismatched
100-
if (delta_exp > detail::precision_v<DecimalType> || delta_exp < -detail::precision_v<DecimalType> ||
101-
((new_lhs_sig == static_cast<comp_type>(0)) ^ (new_rhs_sig == static_cast<comp_type>(0))))
100+
if (new_lhs_sig == static_cast<comp_type>(0) && new_rhs_sig == static_cast<comp_type>(0))
101+
{
102+
return true;
103+
}
104+
if (delta_exp > detail::precision_v<DecimalType> || delta_exp < -detail::precision_v<DecimalType>)
102105
{
103106
return false;
104107
}

0 commit comments

Comments
 (0)