-
Notifications
You must be signed in to change notification settings - Fork 64
Semantics of minNum and maxNum don't match IEEE 754-2008 for signaling NaNs #341
Comments
The API needs to be consistent with JS developer expectations as well as SIMD developer expectations - and as such, differentiable NaNs aren't anything I'd think anybody would expect. What's the hazard you see from leaving it as-is? |
The intent of |
Right, but JS doesn't have qNaN or sNaN, just NaN. |
Right, JS adds non-determinism on top because the NaN values aren't guaranteed, but one of the goals of the SIMD spec is (IIUC?) to be shareable with WebAssembly where the NaN values are observable. WebAssembly has its own NaN observability specification which provides more guarantees. From that POV, I think |
This issue exists independently of the shared spec idea or WebAssembly. It comes down to this: When we added Making these functions aware of signaling NaN would be one way to address this issue, however that would have significant implications for the rest of the SIMD.js spec and probably for JS as well, as it would require us to add semantics to many other places, so that developers could reason about where signaling NaNs might appear. The suggestion above is that we either just rename these functions, to avoid confusion, since |
Without those methods, how can I compare two SIMD values and determine the smaller or larger? The process document specifies that the only changes expected in Stage 3 are "Limited: only those deemed critical based on implementation experience" - this does not fall into that bucket. I don't care what they're called, but the comparative APIs to |
The comparative APIs to
|
aha, ok thanks for clarifying (it's a big API 😉). Given that, I'm withdrawing my opinion from the discussion 😄 |
I am in favor of removing them from SIMD.js, since their semantics doesn't serve any purpose now (neither JS or IEEE compliant). We can add them to WASM after semantics fix. |
I wrote a blog post about the consequences of having non-associative min / max operations. |
See tc39/ecmascript_simd#341 MinNum and MaxNum operations are decided to be removed from Simd.js as they are incompatablie with IEE-754 definitions of MinNum and MaxNum, which makes use of quiet NaN's and signaling NaN's.
See tc39/ecmascript_simd#341 MinNum and MaxNum operations are decided to be removed from Simd.js as they are incompatablie with IEE-754 definitions of MinNum and MaxNum, which makes use of quiet NaN's and signaling NaN's.
See tc39/ecmascript_simd#341 MinNum and MaxNum operations are decided to be removed from Simd.js as they are incompatablie with IEE-754 definitions of MinNum and MaxNum, which makes use of quiet NaN's and signaling NaN's.
Merge pull request #1030 from arunetm:RmF4MinMaxNum See tc39/ecmascript_simd#341 MinNum and MaxNum operations are decided to be removed from Simd.js as they are incompatablie with IEE-754 definitions of MinNum and MaxNum, which makes use of quiet NaN's and signaling NaN's.
The IEEE 754-2008 operations
minNum
andmaxNum
suppress quiet NaNs, but they still propagate signaling NaNs, canonicalising them to qNaNs:The ARMv8
vminnm
andvmaxnm
instructions have the same semantics (my emphasis):The
minNum
andmaxNum
operations currently in our specification don't distinguish between sNaNs and qNaNs. Given our approach to NaNs, it seems difficult to add the distinction.I would suggest that we either:
minNum
andmaxNum
to avoid confusion with the IEEE operations of the same name, orThe text was updated successfully, but these errors were encountered: