Issue #23517: datetime.timedelta constructor now rounds microseconds to nearest

with ties going away from zero (ROUND_HALF_UP), as Python 2 and Python older
than 3.3, instead of rounding to nearest with ties going to nearest even
integer (ROUND_HALF_EVEN).
This commit is contained in:
Victor Stinner 2015-09-02 19:16:07 +02:00
parent 8cbb013553
commit 2ec558739e
6 changed files with 26 additions and 34 deletions

View file

@ -60,8 +60,7 @@ _PyLong_FromTime_t(time_t t)
#endif
}
/* Round to nearest with ties going away from zero (_PyTime_ROUND_HALF_UP). */
static double
double
_PyTime_RoundHalfUp(double x)
{
/* volatile avoids optimization changing how numbers are rounded */