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

f32::from_str and f64::from_str: parser returned error on just a '.' (a dot) #44242

Closed
kamarkiewicz opened this issue Sep 1, 2017 · 6 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@kamarkiewicz
Copy link

Hi! I found a mismatch between documentation and behavior of stable Rust.
When I tried to parse a string equal "." f32/f64::from_str returned Err(...) instead of Ok(0.0), as it states in official documentation here.

Tests (based on mentioned doc)

f32: https://play.rust-lang.org/?gist=c7495df140e0991473fb914b0b468b34&version=stable
f64: https://play.rust-lang.org/?gist=c319d2f10762767b9983907cb9d7f2dc&version=stable

@hanna-kruppe
Copy link
Contributor

This is a docs issue. The libs team decided in #30344 to consider "." an invalid input instead of parsing it as 0.

@steveklabnik steveklabnik added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Sep 1, 2017
@steveklabnik
Copy link
Member

I'd be happy to mentor anyone who wants to fix this, it'd be a great first bug!

@mcomstock
Copy link
Contributor

I'd like to work on this.

@shepmaster shepmaster added the C-bug Category: This is a bug. label Sep 1, 2017
@Freyskeyd
Copy link
Contributor

@mcomstock are you fixing this?

@mcomstock
Copy link
Contributor

Yeah! Sorry for the delay.

@Freyskeyd
Copy link
Contributor

@mcomstock ok let me know if you need help

Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Sep 6, 2017
…klabnik

Removed the incorrect documentation for from_str

Fixes rust-lang#44242.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Sep 7, 2017
…klabnik

Removed the incorrect documentation for from_str

Fixes rust-lang#44242.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

No branches or pull requests

6 participants