|
16 | 16 | #include <boost/decimal/detail/div_impl.hpp> |
17 | 17 | #include <boost/decimal/detail/promote_significand.hpp> |
18 | 18 | #include <boost/decimal/detail/ryu/ryu_generic_128.hpp> |
| 19 | +#include <boost/decimal/detail/promotion.hpp> |
19 | 20 |
|
20 | 21 | #ifndef BOOST_DECIMAL_BUILD_MODULE |
21 | 22 | #include <limits> |
@@ -112,7 +113,7 @@ BOOST_DECIMAL_EXPORT class decimal32_fast final |
112 | 113 | BOOST_DECIMAL_REQUIRES_RETURN(detail::is_decimal_floating_point_v, DecimalType, std::uint32_t); |
113 | 114 |
|
114 | 115 | public: |
115 | | - constexpr decimal32_fast() noexcept {} |
| 116 | + constexpr decimal32_fast() noexcept = default; |
116 | 117 |
|
117 | 118 | template <typename T1, typename T2, std::enable_if_t<detail::is_integral_v<T1> && detail::is_integral_v<T2>, bool> = true> |
118 | 119 | constexpr decimal32_fast(T1 coeff, T2 exp, bool sign = false) noexcept; |
@@ -319,7 +320,10 @@ BOOST_DECIMAL_EXPORT class decimal32_fast final |
319 | 320 |
|
320 | 321 |
|
321 | 322 | // Conversion to other decimal type |
322 | | - template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, std::enable_if_t<detail::is_decimal_floating_point_v<Decimal>, bool> = true> |
| 323 | + template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, std::enable_if_t<detail::is_decimal_floating_point_v<Decimal> && (detail::impl::decimal_val_v<Decimal> > detail::impl::decimal_val_v<decimal32_fast>), bool> = true> |
| 324 | + constexpr operator Decimal() const noexcept; |
| 325 | + |
| 326 | + template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, std::enable_if_t<detail::is_decimal_floating_point_v<Decimal> && (detail::impl::decimal_val_v<Decimal> <= detail::impl::decimal_val_v<decimal32_fast>), bool> = true> |
323 | 327 | explicit constexpr operator Decimal() const noexcept; |
324 | 328 |
|
325 | 329 | friend constexpr auto direct_init(std::uint_fast32_t significand, std::uint_fast8_t exponent, bool sign) noexcept -> decimal32_fast; |
@@ -1341,7 +1345,13 @@ constexpr decimal32_fast::operator std::bfloat16_t() const noexcept |
1341 | 1345 | } |
1342 | 1346 | #endif |
1343 | 1347 |
|
1344 | | -template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, std::enable_if_t<detail::is_decimal_floating_point_v<Decimal>, bool>> |
| 1348 | +template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, std::enable_if_t<detail::is_decimal_floating_point_v<Decimal> && (detail::impl::decimal_val_v<Decimal> > detail::impl::decimal_val_v<decimal32_fast>), bool>> |
| 1349 | +constexpr decimal32_fast::operator Decimal() const noexcept |
| 1350 | +{ |
| 1351 | + return to_decimal<Decimal>(*this); |
| 1352 | +} |
| 1353 | + |
| 1354 | +template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE Decimal, std::enable_if_t<detail::is_decimal_floating_point_v<Decimal> && (detail::impl::decimal_val_v<Decimal> <= detail::impl::decimal_val_v<decimal32_fast>), bool>> |
1345 | 1355 | constexpr decimal32_fast::operator Decimal() const noexcept |
1346 | 1356 | { |
1347 | 1357 | return to_decimal<Decimal>(*this); |
|
0 commit comments