-
-
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
Open
tgross35
wants to merge
5
commits into
rust-lang:main
Choose a base branch
from
tgross35:dec2flt-traits
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
|
|
Collaborator
Contributor
Author
|
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.
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.
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.
89457ed to
038d60f
Compare
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
☔ The latest upstream changes (presumably #152230) made this pull request unmergeable. Please resolve the merge conflicts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-meta
Area: Issues & PRs about the rust-lang/rust repository itself
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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