Hacker News new | ask | show | jobs
by stingraycharles 383 days ago
Yup, because of the imprecision of floating points, cannot just assume that ā€œ(a + c) + (b + d)ā€ is the same as ā€œa + b + c + dā€.

It would be pretty ironic if at some point fixed point / bignum implementations end up being faster because of this.

2 comments

They are, just check anything fixed-point for the 486SX vs anything floating under a 486DX. It's faster scaling and sum and print the desired precision than operating on floats.
Is that also the case for modern architectures? Eg is there SIMD fixed precision?
I wonder... couldn't there just be some library type for this, e.g. `associative::float` and `associative::doube` and such (in C++ terms), so that compilers can ignore non-associativity for actions on values of these types? Or attributes one can place on variables to force assumption of associativity?