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

5.3 issue #1210

Closed
noro74 opened this issue Jun 27, 2019 · 1 comment
Closed

5.3 issue #1210

noro74 opened this issue Jun 27, 2019 · 1 comment

Comments

@noro74
Copy link

noro74 commented Jun 27, 2019

Hi! I have this test code:

fmt::printf("Zero is '%19.0Lf'\n", 0.0L);
fmt::printf("Zero is '%19.0Lf'\n", 0.0);
fmt::printf("Zero is '%19.0f'\n", 0.0);

fmt::printf("0.1 is '%19.0f'\n", 0.1);
fmt::printf("1.1 is '%19.0f'\n", 1.1);
fmt::printf("0.01 is '%19.0f'\n", 0.01);
fmt::printf("1.01 is '%19.0f'\n", 1.01);
fmt::printf("0.11 is '%19.0f'\n", 0.11);
fmt::printf("1.11 is '%19.0f'\n", 1.11);

fmt::printf("-0.1 is '%19.0f'\n", -0.1);
fmt::printf("-1.1 is '%19.0f'\n", -1.1);
fmt::printf("-0.01 is '%19.0f'\n", -0.01);
fmt::printf("-1.01 is '%19.0f'\n", -1.01);
fmt::printf("-0.11 is '%19.0f'\n", -0.11);
fmt::printf("-1.11 is '%19.0f'\n", -1.11);

With 4.1.0 the result is OK:
Zero is ' 0'
Zero is ' 0'
Zero is ' 0'
0.1 is ' 0'
1.1 is ' 1'
0.01 is ' 0'
1.01 is ' 1'
0.11 is ' 0'
1.11 is ' 1'
-0.1 is ' -0'
-1.1 is ' -1'
-0.01 is ' -0'
-1.01 is ' -1'
-0.11 is ' -0'
-1.11 is ' -1'

But whith 5.3 the result is:
Zero is ' 0'
Zero is ' ' (wrong!)
Zero is ' ' (wrong!)
0.1 is ' 0'
1.1 is ' 1'
0.01 is ' 0.0' (wrong!)
1.01 is ' 1'
0.11 is ' 0'
1.11 is ' 1'
-0.1 is ' -0'
-1.1 is ' -1'
-0.01 is ' -0.0' (wrong!)
-1.01 is ' -1'
-0.11 is ' -0'
-1.11 is ' -1'

Can you, please, fix this?

@vitaut
Copy link
Contributor

vitaut commented Jun 30, 2019

Great catch, thanks! Should be fixed now. Note that it's a bug in the development (master) branch, the released version 5.3.0 gives the correct output.

@vitaut vitaut closed this as completed Jun 30, 2019
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