Skip to content

Add parse_float facilities #1

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Add parse_float facilities #1

wants to merge 10 commits into from

Conversation

phorward
Copy link
Owner

@phorward phorward commented Oct 2, 2024

This pull request should add support for floating point numbers to the num-parse-crate.

The branch is already open for a while, and there is a problem with the precision, which shall be equal to the one reached by Rust directly.

The problem is this test, where -1337.0e-298f64 works but -1337.0e-299f64 fails in precision (assertion left == right failed; left: Some(-1.3369999999999998e-296); right: Some(-1.337e-296))

assert_eq!(parse_float::<f64>(" -1337.0e-296f64 "), Some(-1337.0e-296f64));  // OK
assert_eq!(parse_float::<f64>(" -1337.0e-297f64 "), Some(-1337.0e-297f64));  // FAIL

phorward added 7 commits July 9, 2022 15:29
This is a naive approach for a parse_float() that was implemented in Tokay already. See the comment in float.rs for details on how this isn't the best.
Still not equal to Rust's f64 literals, yet.
Still not perfect - the rounding glitches.
@phorward phorward added enhancement New feature or request help wanted Extra attention is needed labels Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant