diff --git a/include/fmt/format.h b/include/fmt/format.h index beb81885..ee4c3cf4 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -730,6 +730,9 @@ struct is_fast_float : bool_constant::is_iec559 && sizeof(T) <= sizeof(double)> {}; template struct is_fast_float : std::false_type {}; +template +using fast_float_t = conditional_t; + template using is_double_double = bool_constant::digits == 106>; @@ -3355,8 +3358,7 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, precision = 6; } else if (is_fast_float::value && !is_constant_evaluated()) { // Use Dragonbox for the shortest format. - using floaty = conditional_t= sizeof(double), double, float>; - auto dec = dragonbox::to_decimal(static_cast(value)); + auto dec = dragonbox::to_decimal(static_cast>(value)); return write_float(out, dec, specs, s, exp_upper, loc); } } @@ -3394,12 +3396,11 @@ FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { if (is_constant_evaluated()) return write(out, value, format_specs()); auto s = detail::signbit(value) ? sign::minus : sign::none; - using float_type = conditional_t; - auto mask = exponent_mask(); + auto mask = exponent_mask>(); if ((bit_cast(value) & mask) == mask) return write_nonfinite(out, std::isnan(value), {}, s); - auto dec = dragonbox::to_decimal(value); + auto dec = dragonbox::to_decimal(static_cast>(value)); int significand_size = count_digits(dec.significand); int exp = dec.exponent + significand_size - 1; if (use_fixed(exp, detail::exp_upper())) {