◐ Shell
clean mode source ↗

Message 107094 - Python tracker

The timedelta(seconds=0.6112295) example is handled correctly because 0.6112295 sec is not half way between two nearest microseconds:

>>> abs(0.6112295 - 0.6112290) == abs(0.6112295 - 0.6112300)
False

The fact that it displays as if it is does not make timedelta rounding wrong.  I am still not sure that it is possible to accumulate rounding error by adding seven doubles, each < 1 to affect the rounded result.

While proving that the rounding is always correct or finding a counter-example is an interesting puzzle, I think it has little practical value.

I will add unit tests and get this patch ready for for commit review, but setting the priority to "low".