[Bug libstdc++/110355] std::format("{}", 1e-7) returns "1e-07" instead of "1e-7"

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 30 17:15:16 GMT 2023


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110355

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oh this is actually std::to_chars not std::format

#include <charconv>

int main()
{
  char buf[5];
  std::to_chars(buf, buf+5, 1e-7);
  if (__builtin_memcmp(buf, "1e-7", 4))
    __builtin_abort();
}


More information about the Gcc-bugs mailing list