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

More cases of "%g" not falling back to decimal mode #122

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

More cases of "%g" not falling back to decimal mode #122

eyalroz opened this issue Aug 7, 2021 · 0 comments

Comments

@eyalroz
Copy link

eyalroz commented Aug 7, 2021

If we printf_("%#.1g", -40661.5), we currently get -40662, but should be getting -4.e+04 : With "%g", the "precision" value means the number of significant digits to show; and if the number isn't fully captured by those, we are supposed to use exponential notation.

eyalroz added a commit to eyalroz/printf that referenced this issue Aug 7, 2021
* Rearranged `sprint_exponential_number`.
* Rewritten the exponential-vs-decimal choice logic for "%g".
* Fixed a latent bug: With precision 0, a decimal point is never printed, even if it should due to alternate mode (`%` flag).
* Some variable renaming for better clarity.
eyalroz added a commit to eyalroz/printf that referenced this issue Aug 7, 2021
* Rearranged `sprint_exponential_number`.
* Rewritten the exponential-vs-decimal choice logic for "%g".
* Fixed a latent bug: With precision 0, a decimal point is never printed, even if it should due to alternate mode (`%` flag).
* Some variable renaming for better clarity.
eyalroz added a commit to eyalroz/printf that referenced this issue Sep 27, 2021
* Rearranged `sprint_exponential_number`.
* Rewritten the exponential-vs-decimal choice logic for "%g".
* Fixed a latent bug: With precision 0, a decimal point is never printed, even if it should due to alternate mode (`%` flag).
* Some variable renaming for better clarity.
KarlK90 pushed a commit to qmk/printf that referenced this issue Jul 7, 2022
…SIZE` preprocessor define. Also, improved the comment about it.
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