@@ -251,6 +251,9 @@ BOOST_DECIMAL_EXPORT class decimal64_t final
251251 template <typename Decimal>
252252 friend constexpr Decimal detail::check_non_finite (Decimal lhs, Decimal rhs) noexcept ;
253253
254+ template <typename Decimal>
255+ friend constexpr Decimal detail::check_non_finite (Decimal x) noexcept ;
256+
254257public:
255258 // 3.2.3.1 construct/copy/destroy
256259 constexpr decimal64_t () noexcept = default;
@@ -1686,7 +1689,7 @@ constexpr auto operator+(const decimal64_t lhs, const Integer rhs) noexcept
16861689 #ifndef BOOST_DECIMAL_FAST_MATH
16871690 if (not_finite (lhs))
16881691 {
1689- return lhs;
1692+ return detail::check_non_finite ( lhs) ;
16901693 }
16911694 #endif
16921695
@@ -1746,7 +1749,7 @@ constexpr auto operator-(const decimal64_t lhs, const Integer rhs) noexcept
17461749 #ifndef BOOST_DECIMAL_FAST_MATH
17471750 if (not_finite (lhs))
17481751 {
1749- return lhs;
1752+ return detail::check_non_finite ( lhs) ;
17501753 }
17511754 #endif
17521755
@@ -1775,7 +1778,7 @@ constexpr auto operator-(const Integer lhs, const decimal64_t rhs) noexcept
17751778 #ifndef BOOST_DECIMAL_FAST_MATH
17761779 if (not_finite (rhs))
17771780 {
1778- return rhs;
1781+ return detail::check_non_finite ( rhs) ;
17791782 }
17801783 #endif
17811784
@@ -1824,7 +1827,7 @@ constexpr auto operator*(const decimal64_t lhs, const Integer rhs) noexcept
18241827 #ifndef BOOST_DECIMAL_FAST_MATH
18251828 if (not_finite (lhs))
18261829 {
1827- return lhs;
1830+ return detail::check_non_finite ( lhs) ;
18281831 }
18291832 #endif
18301833
@@ -1870,17 +1873,16 @@ constexpr auto operator/(const decimal64_t lhs, const Integer rhs) noexcept
18701873 #ifndef BOOST_DECIMAL_FAST_MATH
18711874 // Check pre-conditions
18721875 constexpr decimal64_t zero {0 , 0 };
1873- constexpr decimal64_t nan {boost::decimal::from_bits (boost::decimal::detail::d64_snan_mask)};
1874- constexpr decimal64_t inf {boost::decimal::from_bits (boost::decimal::detail::d64_inf_mask)};
1876+ constexpr decimal64_t inf {from_bits (detail::d64_inf_mask)};
18751877
18761878 const auto lhs_fp {fpclassify (lhs)};
18771879
18781880 switch (lhs_fp)
18791881 {
18801882 case FP_NAN:
1881- return nan ;
1883+ return issignaling (lhs) ? nan_conversion (lhs) : lhs ;
18821884 case FP_INFINITE:
1883- return inf ;
1885+ return lhs ;
18841886 case FP_ZERO:
18851887 return sign ? -zero : zero;
18861888 default :
@@ -1924,13 +1926,10 @@ constexpr auto operator/(const Integer lhs, const decimal64_t rhs) noexcept
19241926
19251927 const auto rhs_fp {fpclassify (rhs)};
19261928
1927- if (rhs_fp == FP_NAN)
1928- {
1929- return nan;
1930- }
1931-
19321929 switch (rhs_fp)
19331930 {
1931+ case FP_NAN:
1932+ return issignaling (rhs) ? nan_conversion (rhs) : rhs;
19341933 case FP_INFINITE:
19351934 return sign ? -zero : zero;
19361935 case FP_ZERO:
0 commit comments