This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | mark.dickinson |
|---|---|
| Recipients | facundobatista, jyasskin, mark.dickinson |
| Date | 2007年12月17日.11:53:24 |
| SpamBayes Score | 0.0034462817 |
| Marked as misclassified | No |
| Message-id | <1197892407.28.0.992780846076.issue1623@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
Cool! Works for me.
I agree that it's not 100% clear that round(large_decimal) should return an integer rather
than raising an exception. But, rightly or wrongly, this is what int(large_decimal) does at
the moment, and it would be surprising to have int and round behave differently in this
respect. The current behaviour also fits with the way that int(large_float) and
round(large_float) behave, with a valid integer result returned even if that integer is
larger than 2**53.
There is of course a problem here that's not present for floats, namely that someone can
write round(Decimal("1e1000000")) and then wonder why his/her computer takes so long to give
an answer. I don't really see any way around this, other than perhaps a note in the docs.
I notice that math.floor(large_float) and math.ceil(large_float) return floats at the
moment. Is this something that would change under PEP 3141? If not, should
floor(large_decimal) and ceil(large_decimal) return Decimal instances instead of integers?
One last thing: would it be worth backporting some of this to Python 2.6, just to avoid
unnecessary divergence of the Decimal code between 2.x and 3.0? I guess the trunc()
function calls would have to be replaced by calls to the __trunc__ method---would this be a
problem?
Mark |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2007年12月17日 11:53:27 | mark.dickinson | set | spambayes_score: 0.00344628 -> 0.0034462817 recipients: + mark.dickinson, facundobatista, jyasskin |
| 2007年12月17日 11:53:27 | mark.dickinson | set | spambayes_score: 0.00344628 -> 0.00344628 messageid: <1197892407.28.0.992780846076.issue1623@psf.upfronthosting.co.za> |
| 2007年12月17日 11:53:27 | mark.dickinson | link | issue1623 messages |
| 2007年12月17日 11:53:24 | mark.dickinson | create | |