|
26 | 26 | #include <boost/decimal/detail/to_decimal.hpp> |
27 | 27 | #include <boost/decimal/detail/promotion.hpp> |
28 | 28 | #include <boost/decimal/detail/check_non_finite.hpp> |
| 29 | +#include <boost/decimal/detail/quantize_impl.hpp> |
29 | 30 | #include <boost/decimal/detail/shrink_significand.hpp> |
30 | 31 | #include <boost/decimal/detail/cmath/isfinite.hpp> |
31 | 32 | #include <boost/decimal/detail/cmath/fpclassify.hpp> |
@@ -497,7 +498,8 @@ BOOST_DECIMAL_EXPORT class alignas(4) decimal_fast32_t final |
497 | 498 | // Specific decimal functionality |
498 | 499 | friend constexpr auto samequantumd32f(decimal_fast32_t lhs, decimal_fast32_t rhs) noexcept -> bool; |
499 | 500 | friend constexpr auto quantexpd32f(decimal_fast32_t x) noexcept -> int; |
500 | | - friend constexpr auto quantized32f(decimal_fast32_t lhs, decimal_fast32_t rhs) noexcept -> decimal_fast32_t; |
| 501 | + template <BOOST_DECIMAL_DECIMAL_FLOATING_TYPE T> |
| 502 | + friend BOOST_DECIMAL_CUDA_CONSTEXPR auto quantize(T lhs, T rhs) noexcept -> T; |
501 | 503 | }; |
502 | 504 |
|
503 | 505 | #ifdef _MSC_VER |
@@ -1684,43 +1686,6 @@ constexpr auto quantexpd32f(const decimal_fast32_t x) noexcept -> int |
1684 | 1686 | return static_cast<int>(x.unbiased_exponent()); |
1685 | 1687 | } |
1686 | 1688 |
|
1687 | | -// Returns: a number that is equal in value (except for any rounding) and sign to x, |
1688 | | -// and which has an exponent set to be equal to the exponent of y. |
1689 | | -// If the exponent is being increased, the value is correctly rounded according to the current rounding mode; |
1690 | | -// if the result does not have the same value, as x, the "inexact" floating-point exception is raised. |
1691 | | -// If the exponent is being decreased and the significand of the result has more digits than the type would allow, |
1692 | | -// the "invalid" floating-point exception is raised and the result is NaN. |
1693 | | -// If one or both operands are NaN, the result is NaN. |
1694 | | -// Otherwise, if only one operand is infinity, the "invalid" floating-point exception is raised and the result is NaN. |
1695 | | -// If both operands are infinity, the result is DEC_INFINITY, with the same sign as x, converted to the type of x. |
1696 | | -// The quantize functions do not signal underflow. |
1697 | | -constexpr auto quantized32f(const decimal_fast32_t lhs, const decimal_fast32_t rhs) noexcept -> decimal_fast32_t |
1698 | | -{ |
1699 | | - #ifndef BOOST_DECIMAL_FAST_MATH |
1700 | | - // Return the correct type of nan |
1701 | | - if (isnan(lhs)) |
1702 | | - { |
1703 | | - return lhs; |
1704 | | - } |
1705 | | - else if (isnan(rhs)) |
1706 | | - { |
1707 | | - return rhs; |
1708 | | - } |
1709 | | - |
1710 | | - // If one is infinity then return a signaling NAN |
1711 | | - if (isinf(lhs) != isinf(rhs)) |
1712 | | - { |
1713 | | - return direct_init(detail::d32_fast_snan, UINT8_C(0)); |
1714 | | - } |
1715 | | - else if (isinf(lhs) && isinf(rhs)) |
1716 | | - { |
1717 | | - return lhs; |
1718 | | - } |
1719 | | - #endif |
1720 | | - |
1721 | | - return {lhs.full_significand(), rhs.biased_exponent(), lhs.isneg()}; |
1722 | | -} |
1723 | | - |
1724 | 1689 | #if !defined(BOOST_DECIMAL_DISABLE_CLIB) |
1725 | 1690 |
|
1726 | 1691 | constexpr decimal_fast32_t::decimal_fast32_t(const char* str, const std::size_t len) |
|
0 commit comments