Hacker News new | ask | show | jobs
by eddd-ddde 382 days ago
How do you handle the lack of commutativity? I've always wondered about the practical implications.
3 comments

I asked an ex-Bloomberg coder this question once after he told me he used floating points to represent currency all the time, and his response was along the lines of “unless you have blindingly-obvious problems like doing operations on near-zero numbers against very large numbers, these calculations are off by small amounts on their least-significant digits. Why would you waste the time or the electricity dealing with a discrepancy that’s not even worth the money to fix?”
Floating-point is completely commutative (ignoring NaN payloads).

It's the associativity law that it fails to uphold.

Nitpick: FP arithmetic is commutative. It's not associative.