generates a decimal representation of the floating-point number value in [first, last).
The format of the resulting decimal representation is similar to printf's g format. Returns an iterator pointing past-the-end of the decimal representation.
16547{
16548 static_cast<void>(last);
16549 JSON_ASSERT(std::isfinite(value));
16550
16551
16552 if (std::signbit(value))
16553 {
16555 *first++ = '-';
16556 }
16557
16558#ifdef __GNUC__
16559#pragma GCC diagnostic push
16560#pragma GCC diagnostic ignored "-Wfloat-equal"
16561#endif
16562
16563 if (value == 0)
16564 {
16565 *first++ = '0';
16566
16567 *first++ = '.';
16568 *first++ = '0';
16569 return first;
16570 }
16571
16572#ifdef __GNUC__
16573#pragma GCC diagnostic pop
16574#endif
16575 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);
16576
16577
16578
16579
16580 int len = 0;
16581 int decimal_exponent = 0;
16582 dtoa_impl::grisu2(first, len, decimal_exponent, value);
16583 JSON_ASSERT(len <= std::numeric_limits<FloatType>::max_digits10);
16584
16585 constexpr int kMinExp = -4;
16586
16587 constexpr int kMaxExp = std::numeric_limits<FloatType>::digits10;
16588 JSON_ASSERT(last - first >= kMaxExp + 2);
16589 JSON_ASSERT(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits<FloatType>::max_digits10);
16590 JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10 + 6);
16591 return dtoa_impl::format_buffer(first, len, decimal_exponent, kMinExp, kMaxExp);
16592}
@ value
the parser finished reading a JSON value