diff --git a/include/fmt/format.h b/include/fmt/format.h index cd43119d..d35207c8 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1303,6 +1303,13 @@ struct float_info::digits == 64 || static const int exponent_bits = 15; }; +// A double-double floating point number. +template +struct float_info::digits >= 106 && + !std::numeric_limits::is_iec559>> { + using carrier_uint = detail::uint128_t; +}; + template struct decimal_fp { using significand_type = typename float_info::carrier_uint; significand_type significand; @@ -2321,13 +2328,20 @@ template constexpr bool isnan(T value) { return !(value >= value); // std::isnan doesn't support __float128. } -template ::value && - !is_float128::value)> +template +struct has_isfinite : std::false_type {}; + +template +struct has_isfinite> + : std::true_type {}; + +template ::value&& + has_isfinite::value)> FMT_CONSTEXPR20 bool isfinite(T value) { if (is_constant_evaluated()) return !isnan(value - value); return std::isfinite(value); } -template ::value)> +template ::value)> constexpr bool isfinite(T value) { return value - value == 0; // std::isfinite doesn't support __float128. } @@ -2525,7 +2539,7 @@ template > FMT_CONSTEXPR auto write(OutputIt out, const T& value) -> enable_if_t< std::is_class::value && !is_string::value && - !std::is_same::value && + !is_floating_point::value && !std::is_same::value && !std::is_same().map(value))>::value, OutputIt> {