@@ -50,27 +50,22 @@ BOOST_DECIMAL_FORCE_INLINE constexpr auto equality_impl(DecimalType lhs, Decimal
5050 return true ;
5151 }
5252
53- // Step 3: Check -0 == +0
54- auto lhs_sig {lhs.full_significand ()};
55- auto rhs_sig {rhs.full_significand ()};
56- if (lhs_sig == 0U && rhs_sig == 0U )
57- {
58- return true ;
59- }
53+ const auto lhs_components {lhs.to_components ()};
54+ const auto rhs_components {rhs.to_components ()};
6055
61- // Step 4: Check signs
62- const auto lhs_neg {lhs.isneg ()};
63- const auto rhs_neg {rhs.isneg ()};
56+ auto lhs_sig {lhs_components.sig };
57+ auto rhs_sig {rhs_components.sig };
6458
65- if (lhs_neg != rhs_neg)
59+ // Step 4: Check signs
60+ if (lhs_components.sign != rhs_components.sign )
6661 {
67- return false ;
62+ return (lhs_sig == 0U && rhs_sig == 0U ) ;
6863 }
6964
7065 // Step 5: Check the exponents
7166 // If the difference is greater than we can represent in the significand than we can assume they are different
72- const auto lhs_exp {lhs. biased_exponent () };
73- const auto rhs_exp {rhs. biased_exponent () };
67+ const auto lhs_exp {lhs_components. exp };
68+ const auto rhs_exp {rhs_components. exp };
7469
7570 const auto delta_exp {lhs_exp - rhs_exp};
7671
@@ -86,7 +81,7 @@ BOOST_DECIMAL_FORCE_INLINE constexpr auto equality_impl(DecimalType lhs, Decimal
8681 //
8782 // We try for multiplication even though it's a small range
8883 // Since it's an order of magnitude faster
89- if (delta_exp <= 4 && delta_exp >= 4 )
84+ if (delta_exp <= 4 && delta_exp >= - 4 )
9085 {
9186 if (delta_exp > 0 )
9287 {
@@ -217,7 +212,7 @@ constexpr auto equal_parts_impl(T1 lhs_sig, U1 lhs_exp, bool lhs_sign,
217212 //
218213 // We try for multiplication even though it's a small range
219214 // Since it's an order of magnitude faster
220- if (delta_exp <= 4 && delta_exp >= 4 )
215+ if (delta_exp <= 4 && delta_exp >= - 4 )
221216 {
222217 if (delta_exp > 0 )
223218 {
0 commit comments