typeof(Int32(1)/Int32(2)) == Float64 @_@

My “AFAIK” comes from https://discourse.julialang.org/t/psa-floating-point-arithmetic/8678/7, me never having seen other instructions emitted, and my code not crashing and burning so far :slight_smile:

The bad thing (that julia never does) would be to load 32bit float operands, extend them to 64 bit, operate via 64bit arithmetic, and then round them back to 32bit and store them into memory.

No, but seriously enjoy the link to the PHP bug I posted in the other thread. Sometimes using higher precision than requested is the devil (in this case we got a catastrophic Denial-of-Service affecting almost every PHP-site at the time, due to the 80bit floating point having a different rounding than the intended 64bit rounding; this was fixed by a volatile in the offending C code, forcing the compiler to put the register into memory between iterations; there was also something about the real culprit being the compiler-flags used by PHP and not the original author of the library, who understood his code perfectly well).

And I am pretty sure that Intel really does 32bit on the vector registers (they won’t tell us what they really do internally, but they will construct a plausible internal state that the CPU could have been in whenever we look, and this should be compatible with the computation having happened in 32 bit).

2 Likes