-
-
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
|
Functions were renamed while changing the signature, @quaternic. Might as well use better names while making a change. Logic separated in traits from num::flt2dec moved to the main macro_rules in fmt/float.rs. Then I found out about how tests were reliant on abstraction. On hindsight I could have undone the abstraction in tests first, as a separate commit. Especially the broken test values would have been nice to see separate. Changes in strategy (Grisu and Dragon) are readable as is I believe. Writing the unsafe all over the new code first, just to have it in a separate commit seemed like an overkill. The idea of making Parts use str without unsafe first before removing it wasn't any better. |
|
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