Intermediate Floating-Point Precision

1 points by olliej


olliej

I think this warrants rediscussion in the context of the unity vs floating point article.

olliej

I’m posting this as the recent unity vs floating point maths included something super surprising: the use of fsqrt (and presumably other x87 instructions obviously).

This obviously means that there’s an additional fp80 to fp64 conversion prior to the float conversion, but more importantly results in double rounding.

While you can set the precision on x87, that setting only affects the significand, not the exponent. This means that even if the precision rounding was correct, the exponent clamping on store can cause an additional rounding.

(Also, people might complain about x87, but intel’s (and kahan) are a large part in why we have ieee754 rather than then many worse options that were presented)