-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Description
MIPS inverts the meaning of the signal/quiet bit in NaNs compared to every other platform. Rust and LLVM assume that platforms follow the standard convention, which can lead to surprising results. This issue tracks that mismatch, but it's not really actionable -- the best we can do is document this more clearly.
Original issue (likely outdated)
The following tests fail on mipsel and mips64el architectures while succeeding most others.
#[cfg(test)]
mod tests {
#[test]
fn min() {
assert_eq!(1f64.min(std::f64::NAN), 1f64);
}
#[test]
fn max() {
assert_eq!(1f64.max(std::f64::NAN), 1f64);
}
}It succeeded on mipsel up to stable 1.36.0 rustc, and started failing in 1.37.0 and newer. I'll attempt to use cargo-bisect-rustc track down the exact nightly version that introduced the change (might take some time because it's a qemu vm that is rather slow).
#52897 (comment) was where the initial discussion started, but it seems to be worth a separate issue instead of creating noise there.
It looks as if the failing platforms have a signaling NAN (sNAN) in opposite to the succeeding ones with a quiet NAN (qNAN).