| 1700 | // floating-point traits base |
| 1701 | template <typename T, int MantissaDigits, int DecimalDigits> |
| 1702 | struct float_traits_base |
| 1703 | { |
| 1704 | static constexpr auto type = node_type::floating_point; |
| 1705 | using native_type = double; |
| 1706 | static constexpr bool is_native = std::is_same_v<T, native_type>; |
| 1707 | static constexpr bool is_signed = true; |
| 1708 | |
| 1709 | static constexpr int bits = static_cast<int>(sizeof(T) * CHAR_BIT); |
| 1710 | static constexpr int digits = MantissaDigits; |
| 1711 | static constexpr int digits10 = DecimalDigits; |
| 1712 | |
| 1713 | static constexpr bool is_losslessly_convertible_to_native = bits <= 64 // |
| 1714 | && digits <= 53 // DBL_MANT_DIG |
| 1715 | && digits10 <= 15; // DBL_DIG |
| 1716 | |
| 1717 | static constexpr bool can_represent_native = digits >= 53 // DBL_MANT_DIG |
| 1718 | && digits10 >= 15; // DBL_DIG |
| 1719 | |
| 1720 | static constexpr bool can_partially_represent_native = digits > 0 && digits10 > 0; |
| 1721 | }; |
| 1722 | template <typename T> |
| 1723 | struct float_traits : float_traits_base<T, std::numeric_limits<T>::digits, std::numeric_limits<T>::digits10> |
| 1724 | {}; |
nothing calls this directly
no outgoing calls
no test coverage detected