Author vstinner
Recipients belopolsky, ethan.furman, mark.dickinson, r.david.murray, tbarbugli, vstinner
Date 2015-02-25.17:31:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424885516.14.0.74068816873.issue23517@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2015-02-25 17:31:56vstinnersetrecipients: + vstinner, mark.dickinson, belopolsky, r.david.murray, ethan.furman, tbarbugli
2015-02-25 17:31:56vstinnersetmessageid: <1424885516.14.0.74068816873.issue23517@psf.upfronthosting.co.za>
2015-02-25 17:31:56vstinnerlinkissue23517 messages
2015-02-25 17:31:55vstinnercreate