Skip to content

NaN > NaN returns true #50811

Closed
Closed
@jimblandy

Description

@jimblandy

The following tests do not pass for me, but I think they should, as comparisons with NaN should always simply evaluate to false:

#[test]
fn test_zero_zero() {
    assert_eq!(0.0/0.0 < 0.0/0.0, false);
    assert_eq!(0.0/0.0 > 0.0/0.0, false);
}

#[test]
fn test_nan_nan() {
    assert_eq!(std::f64::NAN < std::f64::NAN, false);
    assert_eq!(std::f64::NAN > std::f64::NAN, false);
}

fn main() {
    println!("Hello, world!");
}

I get this result on both debug and release builds. I'm on an x86_64 running Linux, rustc 1.27.0-nightly (f0fdaba 2018-05-15).

Metadata

Metadata

Assignees

Labels

A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions