-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
fmt of floating points defragmented #150278
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
base: main
Are you sure you want to change the base?
Conversation
|
|
|
Refactor a little cascaded a little. 😅 I hope you are OK with such big change. The new pad_number method on fmt::Formatter could be part of the core library. |
This comment has been minimized.
This comment has been minimized.
b8e3723 to
6084262
Compare
This comment has been minimized.
This comment has been minimized.
At +1,625 −3,292 (lines), this is quite large indeed, and as such, difficult to review. That is in part due to incorporating many different kinds of changes, which makes it hard to get an idea of what is actually being changed. For one, parts of the diff seem to be just renames of functions or local variables, which would be easy to review if that's all it did. If the renames feel necessary for clarity, it would help to do them in a separate commit.
These look like short commit descriptions. Did you have these as separate commits at some point? |
6084262 to
1198db1
Compare
|
It was a single commit that grew into something big, @quaternic. Functions were renamed while changing their signatures. We might as well use better names when touching those lines. Many comments were rewritten while figuring out what they meant. Logic from traits in num::flt2dec moved to the macro_rules in fmt/float.rs. On hindsight, I should have undone the abstraction in tests first. Especially the broken test values would have been nice to see in a separate commit. I believe the changes in strategy (Grisu and Dragon) are readable as is. |
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #150334) made this pull request unmergeable. Please resolve the merge conflicts. |
1198db1 to
d29f041
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
d29f041 to
aacdf22
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Formatting of floating-points centralised in fmt/float.rs
Drop of numfmt feature; no intermediate Part structure
FullDecoded step from omitted with num::FpCategory
MaybeUninit to str contained in grisu.rs & dragon.rs
Exponent in native bit-width (isize instead of i16)
Decode logic of floating-points explained in comments
Explicit fallback from Grisu to Dragon (with Option)
Abstraction between Grisu and Dragon in tests undone
Fixed buffer-size for formatting in "shortest" mode
Macro instead of traits for generic handling of types
FIX: check_exact macro missed check of last decimal
FIX: faulty values in *_sanity_test due to previous
r? tgross35