-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Split the dec2flt::RawFloat trait for easier reuse
#151905
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
|
|
|
The first two commits can be ignored since they are part of #151900 |
9837f1e to
ec32d31
Compare
This comment has been minimized.
This comment has been minimized.
ec32d31 to
89457ed
Compare
This comment has been minimized.
This comment has been minimized.
89457ed to
038d60f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Currently we have a single `core::num` module that contains both thin wrapper API and higher-complexity numeric routines. Restructure this by moving implementation details to a new `imp` module. This results in a more clean separation of what is actually user-facing compared to items that have a stability attribute because they are public for testing.
038d60f to
6404669
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. |
ff1a43f to
be9bca8
Compare
This comment has been minimized.
This comment has been minimized.
be9bca8 to
4415a63
Compare
Follow up to the previous commit refactoring `core::num` by moving the user-facing error types and trait implementations back out of `imp` and into a new module under `core::num`.
This is more consistent with what the trait is called elsewhere in tree (specifically compiler-builtins and test-float-parse).
`RawFloat` is currently used specifically for the implementation of the lemire algorithm, but it is useful for more than that. Split it into three different traits: * `Float`: Anything that is reasonably applicable to all floating point types. * `FloatExt`: Items that should be part of `Float` but don't work for all float types. This will eventually be merged back into `Float`. * `Lemire`: Items that are specific to the Lemire algorithm.
`Float` and `FloatExt` are already used by both parsing and printing, so move them out of `dec2flt` to a new module in `num::imp`. `Int` `Cast` have the potential to be used more places in the future, so move them there as well. `Lemire` is the only remaining trait; since it is small, move it into the `dec2flt` root.
4415a63 to
9c9c758
Compare
|
The job Click to see the possible cause of the failure (guessed by this bot) |
RawFloatis an internal trait with quite a few useful float properties. It currently resides in thedec2fltmodule but is also used in parsing, and would be nice to reuse other places. Unfortunately it cannot be implemented onf128because of limitations with how the parsing API is implemented (mantissa must fit into a u64).To make the trait easier to work with, split it into the following:
Float: Anything that is reasonably applicable to all floating point types.FloatExt: Items that should be part ofFloatbut don't work for all float types. This will eventually be merged back intoFloatonce it can be implemented on f128.Lemire: Items that are specific to the Lemire dec2flt algorithm.These traits are then moved to places that make sense.
Builds on top of #151900