-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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 comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d29f041 to
aacdf22
Compare
This comment has been minimized.
This comment has been minimized.
aacdf22 to
db91fb0
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. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Thank you for taking a look at this! As @quaternic mentioned, this is a large and pretty messy diff that doesn't have a lot of context. The first commit is fine, but unfortunately I don't really think the second commit is reviewable as-is. Would you be able to split it up? Doing changes approximately what you have listed in the top post would be extremely helpful. It would also be valuable to see the reasoning in the messages: e.g. whether it's a nonfunctional cleanup, benchmark or codegen improvements you saw that motivated that change, etc. As-is, I'm not sure what the intended runtime effects of any of these changes are. Once CI passes, we can run perf. @rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
|
As a complete aside, jj makes organizing commits quite a bit nicer than vanilla git. You can Also easy to do stacked PRs if you choose, since you can put a bookmark (branch) on multiple commits in a series that all get updated if the base changes. |
|
It is very hard if not impossible to undo so many mistakes by using clean and comprehensible steps. That's probably the reason why we ended up with this mikado construction in the first place. As I said, the majority of the change is a full write out of the various parts into float.rs. Maybe you could have a look at this file and tell me whether this is indeed how things should look like @tgross35? If we can agree on the result then I will do a lot on making this work, including rewriting the whole thing into pieces if that's what it takes. Can definitely further elaborate on the issues and fixes. The summary in the description is brief and incomplete. To be honest, I don't understand why the build is failing there. It looks unrelated. Some help would be appreciated. 🙏 |
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