Skip to content

float::from_str returns 0 for one space, and NaN for multiple spaces #1089

Closed
@mbrubeck

Description

@mbrubeck

float::from_str(" ") (the input is a string of two space characters) returns NaN in Rust. It should return 0.0.

float::from_str(" ") (with just one space character) returns 0.0.

There is a test in stdtest/float.rs that should have caught this bug, but it is falsely passing because (NaN == 0.0) is true (#1083).

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions