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

Numeric zero fill is applied to inf/nan #2305

Closed
vasama opened this issue May 22, 2021 · 0 comments · Fixed by #2310
Closed

Numeric zero fill is applied to inf/nan #2305

vasama opened this issue May 22, 2021 · 0 comments · Fixed by #2310

Comments

@vasama
Copy link

vasama commented May 22, 2021

From the documentation (emphasis mine):

Preceding the width field by a zero ('0') character enables sign-aware zero-padding for numeric types. It forces the padding to be placed after the sign or base (if any) but before the digits. This is used for printing fields in the form ‘+000000120’. This option is only valid for numeric types and it has no effect on formatting of infinity and NaN.

fmt::print("'{:+06}'\n", NAN);
// output: '00+nan'

https://godbolt.org/z/Pnh33M6r6

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

Successfully merging a pull request may close this issue.

2 participants