News for hackers. Stuff that matters.
Re:Curious lack of sprintf scaling by jcelerier on Saturday February 26, 2022 @08:58AM (#30477601)
to_string is just a wrapper around sprintf... here's the (de-__uglyfied) code on libstdc++:

    inline string
    to_string(float val)
    {
      const int n = gnu_cxx::numeric_traits<float>::max_exponent10 + 20;
      return gnu_cxx::to_xstring<string>(&std::vsnprintf, n, "%f", val);
    }
it will be worse in pretty much every metric than fmt::format("{}", val);

There are no comments on this comment yet.