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

Alternate form of general format is missing trailing zeros #1797

Closed
Kingcom opened this issue Jul 30, 2020 · 1 comment
Closed

Alternate form of general format is missing trailing zeros #1797

Kingcom opened this issue Jul 30, 2020 · 1 comment

Comments

@Kingcom
Copy link
Contributor

Kingcom commented Jul 30, 2020

According to the syntax documentation, the alternate form should cause general format floating point values to not suppress trailing zeros:

The '#' option causes the “alternate form” to be used for the conversion. [...] In addition, for 'g' and 'G' conversions, trailing zeros are not removed from the result.

This seems to be unimplemented with the current master, parse_float_type_spec only uses the alt flag to determine if a decimal point should be shown. As a result, the following format string does not show any trailing zeros:

fmt::print("{:#.17g}", 0.875);

I've tested various older versions, and it seems to be a regression introduced between 6.0.0 and 6.1.0.

@vitaut
Copy link
Contributor

vitaut commented Aug 8, 2020

Fixed in 4fd95e4. Thanks for reporting.

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