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

            Bug ID: 113512
           Summary: Incorrect results for std::format("{:#.3g}", flt)
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

std::format("{:#.3g}", 0.02) should give 3 significant figures, i.e. "0.0200"

But libstdc++ counts the leading zeros as significant, so gives "0.02"

std::format("{:#.3g}", 0.025) should give "0.0250" but instead throws an
exception!

Reply via email to