Skip to content

Commit

Permalink
Improve operator >=
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Jul 17, 2024
1 parent 9ffb696 commit 8d6bedd
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions include/boost/decimal/decimal32_fast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,13 +560,29 @@ constexpr auto operator>(decimal32_fast lhs, decimal32_fast rhs) noexcept -> boo
constexpr auto operator>=(decimal32_fast lhs, decimal32_fast rhs) noexcept -> bool
{
#ifndef BOOST_DECIMAL_FAST_MATH
if (isnan(lhs) || isnan(rhs))
if (!isfinite(lhs) || !isfinite(rhs))
{
return false;
if (isnan(lhs) || isnan(rhs))
{
return false;
}
else if (lhs.isneg() && !rhs.isneg())
{
return false;
}
else if (isfinite(lhs) && isinf(rhs))
{
return signbit(rhs);
}
else if (isinf(lhs) && isfinite(rhs))
{
return !signbit(lhs);
}
}
#endif

return !(lhs < rhs);
return !fast_type_less_parts_impl(lhs.significand_, lhs.biased_exponent(), lhs.sign_,
rhs.significand_, rhs.biased_exponent(), rhs.sign_);
}

template <typename Integer>
Expand Down

0 comments on commit 8d6bedd

Please sign in to comment.