Skip to content

Incorrect &str => f64 results #18659

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

Closed
alexcrichton opened this issue Nov 5, 2014 · 6 comments
Closed

Incorrect &str => f64 results #18659

alexcrichton opened this issue Nov 5, 2014 · 6 comments

Comments

@alexcrichton
Copy link
Member

Perhaps an off-by-one-somewhere?

fn main() {                                 
    let f: f64 = from_str("-3.14").unwrap();
    println!("{}", f);                      
}                                           
$ rustc foo.rs && ./foo
-13.14

cc @bjz, probably related to #18536

@brendanzab
Copy link
Member

Ack, sorry! Can't address this just yet - studying for an exam.

@brendanzab
Copy link
Member

@SimonSapin also reports:

from_str::<f64>("-2") returns -12.0

@brendanzab
Copy link
Member

This commit seems to fix it: juxiliary/rust@f1b51c70f4fe193f98359dfa14a8d16e9f64978d

Could someone make a PR? I am tight for time.

@nixpulvis
Copy link

Seems to be fixed by #18713.

SimonSapin added a commit to servo/rust-cssparser that referenced this issue Nov 7, 2014
@SimonSapin
Copy link
Contributor

Confirmed fixed in #18713, should be closed.

@alexcrichton
Copy link
Member Author

Thanks everyone!

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

4 participants