-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Ryu: add support for maximum significant digits #33520
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for doing this!
The only remaining question is what to do about Float16: the easiest thing I can think of is to change it so that it switches to exponent notation for |
I think that's a good idea; I feel like the previous rules were weirdly complex/inconsistent. |
8eb7849
to
a950f82
Compare
Okay, this now gives
|
There are a few weird edge cases where we don't actually print the closest value in order to get a trailing 0 digit:
and for
The options:
|
b6f5258
to
fb7865e
Compare
Alright, I've gone for option 3 above, as I think that is the most consistent. Since this and the Note that this will change non-subnormal values as well, e.g.
|
5aa3fde
to
7901c74
Compare
1bae680
to
06079a6
Compare
Okay, it has become clear that would be a bigger change than I thought. I'll save that for a new issue. |
That decision seems fine to me 👍 |
Thanks for doing this @simonbyrne; it makes me feel much better knowing someone else has done a deep dive into this code. :) |
This moves the compact truncation to the main reduction stage, which avoids problems with double rounding.
Fixes #33463