| ▲ | addaon 2 hours ago | |
Don't have the spec handy, but specifically binary operations combining two NaN inputs must result in one of the input NaNs. For all of Intel SSE, AMD SSE, PowerPC, and ARM, the left hand operand is returned if both are signaling or both or quiet. x87 does weird things (but when doesn't it?), and ARM does weird things when mixing signaling and quiet NaNs. | ||
| ▲ | ekelsen an hour ago | parent [-] | |
I also don't have access to the spec, but the people writing Rust do and they claim this: "IEEE makes almost no guarantees about the sign and payload bits of the NaN" https://rust-lang.github.io/rfcs/3514-float-semantics.html See also this section of wikipedia https://en.wikipedia.org/wiki/NaN#Canonical_NaN "On RISC-V, most floating-point operations only ever generate the canonical NaN, even if a NaN is given as the operand (the payload is not propagated)." And from the same article: "IEEE 754-2008 recommends, but does not require, propagation of the NaN payload." (Emphasis mine) I call bullshit on the statement "specifically binary operations combining two NaN inputs must result in one of the input NaNs." It is definitely not in the spec. | ||