Skip to content
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

proper implementation of float and double parsers from text representation #902

Closed
Geal opened this issue Apr 6, 2019 · 3 comments
Closed
Milestone

Comments

@Geal
Copy link
Collaborator

Geal commented Apr 6, 2019

right now we use recognize_float then call .parse::<f64>() on the recognized input, which means the data is parsed twice. It is necessary because parse() assumes it has the full input, and will not return remaining input data if there is some after the number. This is the main reason for serde being faster than nom on JSON benchmarks: serde constructs the number as it is parsing it.
We need a float parser that does that.

@Geal Geal added this to the 5.0 milestone Apr 6, 2019
@Geal Geal mentioned this issue Apr 6, 2019
22 tasks
@pickfire
Copy link

What about parsing something like 0.01f32 as seen in rust?

@Geal
Copy link
Collaborator Author

Geal commented Apr 27, 2019

@pickfire not really in scope. Anyone can implement that by writing terminated(float, tag("f32"))

@Geal
Copy link
Collaborator Author

Geal commented Apr 27, 2019

nom 5 will now use the lexical-core crate to parse float since 40f20aa

@Geal Geal closed this as completed Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants