Skip to content

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.

2 participants