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

printf("%# 01.1g", 9.8) results in many 0's due to underflow #155

Closed
eyalroz opened this issue Jul 9, 2023 · 1 comment
Closed

printf("%# 01.1g", 9.8) results in many 0's due to underflow #155

eyalroz opened this issue Jul 9, 2023 · 1 comment
Labels
bug Something isn't working resolved-on-develop A changeset fixing this issue has been commiutted to the development branch

Comments

@eyalroz
Copy link
Owner

eyalroz commented Jul 9, 2023

$ build/test/autotest -ap14  1>/dev/null

fmt = "%# 01.1g" value = 9.808931350708007812
libc:     " 1.e+01"
our lib:  "00000000000000000000000000000000"

that's not right... :-(

@eyalroz eyalroz added the bug Something isn't working label Jul 9, 2023
@eyalroz eyalroz changed the title printf("%# 01.1g", 9.80893135070800781) fails printf("%# 01.1g", 9.8) results in many 0's Jul 10, 2023
@eyalroz eyalroz changed the title printf("%# 01.1g", 9.8) results in many 0's printf("%# 01.1g", 9.8) results in many 0's - underflow Jul 10, 2023
@eyalroz
Copy link
Owner Author

eyalroz commented Jul 10, 2023

The cause is underflow of the precision value in print_exponential_number(), running with fall_back_to_decimal_only_mode.

@eyalroz eyalroz added the resolved-on-develop A changeset fixing this issue has been commiutted to the development branch label Jul 10, 2023
@eyalroz eyalroz changed the title printf("%# 01.1g", 9.8) results in many 0's - underflow printf("%# 01.1g", 9.8) results in many 0's due to underflow Jul 10, 2023
eyalroz added a commit that referenced this issue Aug 1, 2023
eyalroz added a commit that referenced this issue Jul 19, 2024
phillipjohnston added a commit to embeddedartistry/printf that referenced this issue Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved-on-develop A changeset fixing this issue has been commiutted to the development branch
Projects
None yet
Development

No branches or pull requests

1 participant