3 ms·
> Regardless, those optimisations are available on the respective JITs. I'm pretty sure this is wrong. No JS engine, RyuJIT or or HotSpot break IEE-754. Java d
by afdbcreid 2mo ago
> Regardless, those optimisations are available on the respective JITs.
I'm pretty sure this is wrong. No JS engine, RyuJIT or or HotSpot break IEE-754. Java does have intrinsics for algebraic floating point operations (but does not apply them by default and I don't think they're exposed), the other I don't think.
- pjmlp 2mo agoI linked the documentation....
- afdbcreid 2mo agoI'm not sure what you tried to prove by those docs, but they don't say that they deviate from IEEE-754.
- jcranmer 2mo agoI did a deep dive a while back into the floating-point semantics of many languages, included JIT'd languages, which mostly uncovers that very few languages are particularly precise in their specification. The tl;dr for the relevant languages here is: * Java requires full IEEE 754 conformance (and bounds ULPs on java.lang.Math functions, although not fully correctly-rounded), although (now removed) strictfp permitted a slightly more relaxed mode to make it easier to implement using x87 FPU arithmetic. * C# has license for excess precision mode and denormal flushing. * JS is strict IEEE 754 conformance, except for math library functions (which can be more approximate). * Go permits FMA contraction (but is otherwise silent). * Most other interpreted/JIT'd languages pretty much go "you get your machine floating-point." And, FWIW, all of those floating-point semantics are orthogonal to things enabled by -ffast-math or similar flags! The only languages that really discuss such things are C (in a TS nobody implements), Fortran (which lets you rearrange expressions as long as you preserve parentheses), Julia (which has a fast_fma-like function and a fast-math macro), and now Rust.
- memming 2mo ago@fastmath in Julia!
- pklausler 2mo agoSadly, Fortran’s guarantee of the “integrity of parentheses” has been undermined lately by its standard committee.
- aw1621107 2mo agoWhat recent change(s) were made?
- pklausler 2mo agoThey ruled that the “integrity of parentheses” can be violated by fused multiply-adds, despite clear long-standing language to the contrary. So “(x * y)+z” can be compiled as if it were “x * y+z” and only undergo one rounding.
- aw1621107 2mo agoAh, I see. Thanks for taking the time to elaborate!