4 ms·
How do you handle the lack of commutativity? I've always wondered about the practical implications.
by eddd-ddde 1y ago
How do you handle the lack of commutativity? I've always wondered about the practical implications.
- jcranmer 1y agoFloating-point is completely commutative (ignoring NaN payloads). It's the associativity law that it fails to uphold.
- jakevoytko 1y agoI 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?”
- BeetleB 1y agoNitpick: FP arithmetic is commutative. It's not associative.