| 2369 | |
| 2370 | template <typename Char, typename OutputIt> |
| 2371 | FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, |
| 2372 | format_specs specs, sign s) -> OutputIt { |
| 2373 | auto str = |
| 2374 | isnan ? (specs.upper() ? "NAN" : "nan") : (specs.upper() ? "INF" : "inf"); |
| 2375 | constexpr size_t str_size = 3; |
| 2376 | auto size = str_size + (s != sign::none ? 1 : 0); |
| 2377 | // Replace '0'-padding with space for non-finite values. |
| 2378 | const bool is_zero_fill = |
| 2379 | specs.fill_size() == 1 && specs.fill_unit<Char>() == '0'; |
| 2380 | if (is_zero_fill) specs.set_fill(' '); |
| 2381 | return write_padded<Char>(out, specs, size, |
| 2382 | [=](reserve_iterator<OutputIt> it) { |
| 2383 | if (s != sign::none) |
| 2384 | *it++ = detail::getsign<Char>(s); |
| 2385 | return copy<Char>(str, str + str_size, it); |
| 2386 | }); |
| 2387 | } |
| 2388 | |
| 2389 | // A decimal floating-point number significand * pow(10, exp). |
| 2390 | struct big_decimal_fp { |