3 ms·
There's a simpler explanation: IEEE 754 does not require the operations in question to be defined. They are spelled out in Section 9 (Recommended operations).
by TAForObvReasons 7y ago
There's a simpler explanation: IEEE 754 does not require the operations in question to be defined. They are spelled out in Section 9 (Recommended operations). There's some corner-case guidance (for example, divideByZero for log(0)), but they are implementation-dependent and different JS engines producing slightly different values are all in compliance with the actual requirements.
- titzer 7y agoIt's worth pointing out that some programming languages do indeed dictate precision for more advanced operations. E.g. Java requires Math.sin to be precise to 1up: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#sin-double- https://docs.oracle.com/javase/8/docs/api/java/lang/Math.htm...
- lifthrasiir 7y ago1 ulp precision means that there are at most two possible results from given operations. Without an explicit guarantee (probably impossible, as this would essentially pin the algorithm down) they are still not reproducible.