Skip to content

(NaN == x) and (NaN < x) and (x < NaN) are true for all x:float #1083

Closed
@mbrubeck

Description

@mbrubeck

NaN should not be less than, equal to, or greater than any number. But in Rust, float::NaN < 0.0 evaluates to true.

In fact, all of the following assertions pass:

assert(float::NaN() == float::infinity());
assert(float::NaN() == float::neg_infinity());
assert(float::NaN() == 0.);
assert(float::NaN() < 0.);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions