STINNER Victor added the comment: > Would you consider going back to round to nearest?
I don't understand "nearest". I prefer to use names of decimal rounding modes: https://docs.python.org/dev/library/decimal.html#rounding-modes In my local patch, I'm using ROUND_FLOOR in _decimal: "Round towards -Infinity." > Mark and I put in a lot of effort to get the rounding in the datetime module > right. (See for example, #8860.) I'm unable right now to say which rounding mode should be used in the decimal module. But it's important to use the same rounding mode for all similar operations. For example, time.time() and datetime.datetime.now() should have the same rounding method (bad example, time.time() returns a float, which doesn't round the result). For example, in my local patch, I'm using ROUND_FLOOR for: - datetime.date.fromtimestamp() - datetime.datetime.fromtimestamp() - datetime.datetime.now() - datetime.datetime.utcnow() - os.utime() - time.clock_settime() - time.gmtime() - time.localtime() - time.ctime() Note: the Python implementation of datetime uses time.localtime() and time.gmtime() for fromtimestamp(), so these functions should also have the same rounding method. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23517> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com