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

Siginificant-digits-to-precision transition made invalid by rounding #124

Open
eyalroz opened this issue Aug 14, 2021 · 0 comments
Open

Comments

@eyalroz
Copy link

eyalroz commented Aug 14, 2021

If we sprintf(buffer,"%#.3g", 99.99);, we get 100.0 - with 4 significant digits - while we should be getting 100., with 3 significant digits.

This is because, initially, we find the power of 10 to be 2; then we translate significant digits to precision, setting the precision to 1. But after this happens, we perform rounding with precision 1, so that the power of 10 becomes 3...

eyalroz added a commit to eyalroz/printf that referenced this issue Aug 14, 2021
…ing owhen printing "%g"-specifier values in "%f" notation. Also, added a testcase check for when such rollover occurs.
eyalroz added a commit to eyalroz/printf that referenced this issue Aug 14, 2021
…er component during rounding when printing "%g"-specifier values in decimal notation. Also, added a testcase check for when such rollover occurs.
eyalroz added a commit to eyalroz/printf that referenced this issue Aug 15, 2021
…er component during rounding when printing "%g"-specifier values in decimal notation. Also, added a testcase check for when such rollover occurs.
eyalroz added a commit to eyalroz/printf that referenced this issue Aug 15, 2021
…er component during rounding when printing "%g"-specifier values in decimal notation. Also, added a testcase check for when such rollover occurs.
eyalroz added a commit to eyalroz/printf that referenced this issue Sep 27, 2021
…er component during rounding when printing "%g"-specifier values in decimal notation. Also, added a testcase check for when such rollover occurs.
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

1 participant