4 ms·
> it doesn't matter whether the + operator binds tighter to the left or to the right Depending on the language, (a+b) + c may or may not be the equivalent of a
by MaxBarraclough 7y ago
> it doesn't matter whether the + operator binds tighter
to the left or to the right
Depending on the language, (a+b) + c may or may not be the equivalent of a + (b + c)
Interesting. Apparently this is true in Python because it uses bignum numbers.
As I understand it, it's true in Java too, because (signed) integer overflow is defined to wrap-around. It's not true in C, where signed overflow invokes undefined behaviour. In C# it depends on the mode whether you get wrap-around or an exception on overflow.
And of course it's never true with floating-point.