Bayley, Alistair wrote:
You also need to specify, or let the user specify, the order of
arithmetic. I.e. adding a day and then a second is different from
doing it the other way around.
Only when leap seconds are involved. A month and a day would be a
better example.
Duration arithmetic is not commutative? Can you give some examples please,
because I'm not able to imagine any.
April 30th + 1 month + 1 day = May 30th + 1 day = May 31st
April 30th + 1 day + 1 month = May 1st + 1 month = June 1st
What reason is there to say May 30 + 1 day == May 31st? May 30 + 1 day
= June first. So the answer is the same either way, as long as your
result for May 30 + 1 day is correct.