Skip to content

Commit 633b11d

Browse files
committed
Reduce d32_fast isnan to a single comparison
1 parent 1feeee0 commit 633b11d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

include/boost/decimal/decimal32_fast.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ namespace decimal {
2828

2929
namespace detail {
3030

31-
BOOST_DECIMAL_CONSTEXPR_VARIABLE auto d32_fast_inf = std::numeric_limits<std::uint_fast32_t>::max();
32-
BOOST_DECIMAL_CONSTEXPR_VARIABLE auto d32_fast_qnan = std::numeric_limits<std::uint_fast32_t>::max() - 1;
33-
BOOST_DECIMAL_CONSTEXPR_VARIABLE auto d32_fast_snan = std::numeric_limits<std::uint_fast32_t>::max() - 2;
31+
BOOST_DECIMAL_CONSTEXPR_VARIABLE auto d32_fast_inf = std::numeric_limits<std::uint_fast32_t>::max() - 3;
32+
BOOST_DECIMAL_CONSTEXPR_VARIABLE auto d32_fast_qnan = std::numeric_limits<std::uint_fast32_t>::max() - 2;
33+
BOOST_DECIMAL_CONSTEXPR_VARIABLE auto d32_fast_snan = std::numeric_limits<std::uint_fast32_t>::max() - 1;
3434

3535
}
3636

@@ -461,7 +461,7 @@ constexpr auto isinf(decimal32_fast val) noexcept -> bool
461461
constexpr auto isnan(decimal32_fast val) noexcept -> bool
462462
{
463463
#ifndef BOOST_DECIMAL_FAST_MATH
464-
return val.significand_ == detail::d32_fast_qnan || val.significand_ == detail::d32_fast_snan;
464+
return val.significand_ >= detail::d32_fast_qnan;
465465
#else
466466
static_cast<void>(val);
467467
return false;
@@ -489,7 +489,7 @@ constexpr auto isnormal(decimal32_fast val) noexcept -> bool
489489

490490
constexpr auto isfinite(decimal32_fast val) noexcept -> bool
491491
{
492-
return val.significand_ < detail::d32_fast_snan;
492+
return val.significand_ < detail::d32_fast_inf;
493493
}
494494

495495
constexpr auto operator==(decimal32_fast lhs, decimal32_fast rhs) noexcept -> bool

0 commit comments

Comments
 (0)