| 2586 | template <typename Char, typename Grouping, typename OutputIt, |
| 2587 | typename DecimalFP> |
| 2588 | FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, |
| 2589 | const format_specs& specs, sign s, |
| 2590 | int exp_upper, locale_ref loc) -> OutputIt { |
| 2591 | Char point = specs.localized() ? detail::decimal_point<Char>(loc) : Char('.'); |
| 2592 | int significand_size = get_significand_size(f); |
| 2593 | int exp = f.exponent + significand_size - 1; |
| 2594 | if (specs.type() == presentation_type::fixed || |
| 2595 | (specs.type() != presentation_type::exp && |
| 2596 | use_fixed(exp, specs.precision > 0 ? specs.precision : exp_upper))) { |
| 2597 | return write_fixed<Char, Grouping>(out, f, significand_size, point, specs, |
| 2598 | s, loc); |
| 2599 | } |
| 2600 | |
| 2601 | // Write value in the exponential format. |
| 2602 | int num_zeros = 0; |
| 2603 | long long size = significand_size + (s != sign::none ? 1 : 0); |
| 2604 | if (specs.alt()) { |
| 2605 | num_zeros = max_of(specs.precision - significand_size, 0); |
| 2606 | size += num_zeros; |
| 2607 | } else if (significand_size == 1) { |
| 2608 | point = Char(); |
| 2609 | } |
| 2610 | size += (point ? 1 : 0) + compute_exp_size(exp); |
| 2611 | char exp_char = specs.upper() ? 'E' : 'e'; |
| 2612 | auto write = [=](reserve_iterator<OutputIt> it) { |
| 2613 | if (s != sign::none) *it++ = detail::getsign<Char>(s); |
| 2614 | // Insert a decimal point after the first digit and add an exponent. |
| 2615 | it = write_significand(it, f.significand, significand_size, 1, point); |
| 2616 | if (num_zeros > 0) it = detail::fill_n(it, num_zeros, Char('0')); |
| 2617 | *it++ = Char(exp_char); |
| 2618 | return write_exponent<Char>(exp, it); |
| 2619 | }; |
| 2620 | size_t usize = static_cast<size_t>(size); |
| 2621 | return specs.width > 0 |
| 2622 | ? write_padded<Char, align::right>(out, specs, usize, write) |
| 2623 | : base_iterator(out, write(reserve(out, usize))); |
| 2624 | } |
| 2625 | |
| 2626 | template <typename Char, typename OutputIt, typename DecimalFP> |
| 2627 | FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& f, |
nothing calls this directly
no test coverage detected