Why does changing the sum order returns a different result?
23.53 + 5.88 + 17.64
= 47.05
23.53 + 17.64 + 5.88
= 47.050000000000004
Both Java and JavaScript return the same results.
I understand that, due to the way floating point numbers are represented in binary, some rational numbers (like 1/3 – 0.333333…) cannot be represented precisely.
Why does simply changing the order of the elements affect the result?