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: %a output exponent is incorrect (should be decimal, not hexadecimal) #7362

Closed
drinkcat opened this issue Feb 26, 2025 · 1 comment · Fixed by #7365
Closed

printf: %a output exponent is incorrect (should be decimal, not hexadecimal) #7362

drinkcat opened this issue Feb 26, 2025 · 1 comment · Fixed by #7365

Comments

@drinkcat
Copy link
Contributor

drinkcat commented Feb 26, 2025

%a should output "Hexadecimal floating point, lowercase"

For small numbers below 1, the exponent is printed incorrectly:

$ cargo run printf "%a\n" 0.5
0x1.0000000000000p+ffffffffffffffff /// This should be 0x1.0000000000000p-1
$ printf "%a\n" 0.5
0x8p-4

We'll cover issues with shifting (0x8 or 0x1) and padding in another issue.

@drinkcat drinkcat changed the title printf: %a output is incorrect (or inconsistent) printf: %a output exponent is incorrect (should be decimal, not hexadecimal) Feb 26, 2025
@drinkcat
Copy link
Contributor Author

Looking further into this, this is a can of worms... I'll retarget this issue for the exponent issue only, and file another one for the formatting.

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