Join Nostr
2026-08-14 01:23:06 UTC

demofox on Nostr: TIL about floating point math: float w=a*b; float e=fma(-a,b,w); w is the closest ...

TIL about floating point math:

float w=a*b;
float e=fma(-a,b,w);

w is the closest float possible to the real answer of a*b, but the difference between that and the actual answer can be significant.

e is that difference, and apparently the difference is exactly representable as a float.