Skip to content

Subtle difference with fancy double floating point output b/w printf and fmt #2091

Description

@mwinterb

See https://gcc.godbolt.org/z/dojMjE
printf'ing the number -0.00884311 with %06.0f produces -00000 (hyphen followed by 5 zeroes). With fmt::printf and with, what I believe to be the equivalent fmt::print format specifier, {:>06.0f}, fmtlib produces -0000 (hyphen followed by 4 zeroes). -0.1 always produces -00000.
The positive form of the number is also different, with printf producing 6 zeroes and fmtlib producing 5.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions