@@ -221,6 +221,9 @@ BOOST_DECIMAL_EXPORT class decimal_fast128_t final
221221 template <typename Decimal>
222222 friend constexpr Decimal detail::check_non_finite (Decimal lhs, Decimal rhs) noexcept ;
223223
224+ template <typename Decimal>
225+ friend constexpr Decimal detail::check_non_finite (Decimal x) noexcept ;
226+
224227public:
225228 constexpr decimal_fast128_t () noexcept = default;
226229
@@ -1043,7 +1046,7 @@ constexpr auto operator+(const decimal_fast128_t& lhs, const Integer rhs) noexce
10431046 #ifndef BOOST_DECIMAL_FAST_MATH
10441047 if (not_finite (lhs))
10451048 {
1046- return lhs;
1049+ return detail::check_non_finite ( lhs) ;
10471050 }
10481051 #endif
10491052
@@ -1094,7 +1097,7 @@ constexpr auto operator-(const decimal_fast128_t& lhs, const Integer rhs) noexce
10941097 #ifndef BOOST_DECIMAL_FAST_MATH
10951098 if (not_finite (lhs))
10961099 {
1097- return lhs;
1100+ return detail::check_non_finite ( lhs) ;
10981101 }
10991102 #endif
11001103
@@ -1119,7 +1122,7 @@ constexpr auto operator-(const Integer lhs, const decimal_fast128_t& rhs) noexce
11191122 #ifndef BOOST_DECIMAL_FAST_MATH
11201123 if (not_finite (rhs))
11211124 {
1122- return rhs;
1125+ return detail::check_non_finite ( rhs) ;
11231126 }
11241127 #endif
11251128
@@ -1162,7 +1165,7 @@ constexpr auto operator*(const decimal_fast128_t& lhs, const Integer rhs) noexce
11621165 #ifndef BOOST_DECIMAL_FAST_MATH
11631166 if (not_finite (lhs))
11641167 {
1165- return lhs;
1168+ return detail::check_non_finite ( lhs) ;
11661169 }
11671170 #endif
11681171
@@ -1302,7 +1305,6 @@ constexpr auto operator/(const decimal_fast128_t& lhs, const Integer rhs) noexce
13021305 #ifndef BOOST_DECIMAL_FAST_MATH
13031306 // Check pre-conditions
13041307 constexpr decimal_fast128_t zero {0 , 0 };
1305- constexpr decimal_fast128_t nan {direct_init_d128 (detail::d128_fast_qnan, 0 , false )};
13061308 constexpr decimal_fast128_t inf {direct_init_d128 (detail::d128_fast_inf, 0 , false )};
13071309
13081310 const bool sign {lhs.isneg () != (rhs < 0 )};
@@ -1312,9 +1314,9 @@ constexpr auto operator/(const decimal_fast128_t& lhs, const Integer rhs) noexce
13121314 switch (lhs_fp)
13131315 {
13141316 case FP_NAN:
1315- return nan ;
1317+ return issignaling (lhs) ? nan_conversion (lhs) : lhs; ;
13161318 case FP_INFINITE:
1317- return inf ;
1319+ return lhs ;
13181320 case FP_ZERO:
13191321 return sign ? -zero : zero;
13201322 default :
@@ -1345,20 +1347,16 @@ constexpr auto operator/(const Integer lhs, const decimal_fast128_t& rhs) noexce
13451347 #ifndef BOOST_DECIMAL_FAST_MATH
13461348 // Check pre-conditions
13471349 constexpr decimal_fast128_t zero {0 , 0 };
1348- constexpr decimal_fast128_t nan {boost::decimal::direct_init_d128 (boost::decimal::detail::d128_fast_qnan, 0 , false )};
1349- constexpr decimal_fast128_t inf {boost::decimal::direct_init_d128 (boost::decimal::detail::d128_fast_inf, 0 , false )};
1350+ constexpr decimal_fast128_t inf {direct_init_d128 (detail::d128_fast_inf, 0 , false )};
13501351
13511352 const bool sign {(lhs < 0 ) != rhs.isneg ()};
13521353
13531354 const auto rhs_fp {fpclassify (rhs)};
13541355
1355- if (rhs_fp == FP_NAN)
1356- {
1357- return nan;
1358- }
1359-
13601356 switch (rhs_fp)
13611357 {
1358+ case FP_NAN:
1359+ return issignaling (rhs) ? nan_conversion (rhs) : rhs;
13621360 case FP_INFINITE:
13631361 return sign ? -zero : zero;
13641362 case FP_ZERO:
0 commit comments