Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mwinterb opened this issue Jan 12, 2021 · 1 comment
Closed

Comments

@mwinterb
Copy link
Contributor

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.

@vitaut
Copy link
Contributor

vitaut commented Jan 15, 2021

Good catch, thanks! Fixed in 532e846.

@vitaut vitaut closed this as completed Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants