Issue7233
Created on 2009-10-29 09:21 by skrah, last changed 2009-10-29 12:25 by mark.dickinson.
|
msg94649 - (view) |
Author: Stefan Krah (skrah) |
Date: 2009-10-29 09:21 |
|
Hi,
I got two issues with the all-important function rotate():
1. It should probably convert an integer argument:
>>> from decimal import *
>>> c = getcontext()
>>> c.prec = 4
>>> Decimal("1000000000").rotate(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/decimal.py", line 3411, in rotate
ans = self._check_nans(other, context)
File "/usr/lib/python2.7/decimal.py", line 738, in _check_nans
other_is_nan = other._isnan()
2. When the coefficient size is greater than prec, the most significant
digits should be truncated before rotating:
>>> c.prec = 4
>>> Decimal("1000000000").rotate(Decimal(1))
Decimal('1')
The result should be 0 (checked against decNumber).
|
|
msg94650 - (view) |
Author: Mark Dickinson (mark.dickinson) |
Date: 2009-10-29 09:23 |
|
Agreed on both counts. I'll take a look.
|
|
msg94656 - (view) |
Author: Mark Dickinson (mark.dickinson) |
Date: 2009-10-29 10:46 |
|
The shift function should also accept an integer 2nd argument.
|
|
msg94658 - (view) |
Author: Mark Dickinson (mark.dickinson) |
Date: 2009-10-29 12:04 |
|
There were a number of Decimal methods that failed to accept an integer
second argument. I've fixed that in r75944.
|
|
msg94659 - (view) |
Author: Mark Dickinson (mark.dickinson) |
Date: 2009-10-29 12:11 |
|
And the shift and rotate bugs for large arguments are fixed in r75945.
|
|
msg94661 - (view) |
Author: Mark Dickinson (mark.dickinson) |
Date: 2009-10-29 12:25 |
|
Merged (along with a test numbering fix in extra.decTest) in r75946
(release26-maint), r75947 (py3k) and r75948 (release31-maint).
Thanks for the report!
|
|
| Date |
User |
Action |
Args |
| 2009-10-29 12:25:32 | mark.dickinson | set | status: open -> closed
versions:
+ Python 3.1, Python 3.2 resolution: fixed messages:
+ msg94661 priority: normal components:
+ Library (Lib) type: behavior stage: committed/rejected |
| 2009-10-29 12:11:48 | mark.dickinson | set | messages:
+ msg94659 |
| 2009-10-29 12:04:10 | mark.dickinson | set | messages:
+ msg94658 |
| 2009-10-29 10:46:02 | mark.dickinson | set | messages:
+ msg94656 |
| 2009-10-29 09:23:57 | mark.dickinson | set | assignee: mark.dickinson messages:
+ msg94650 |
| 2009-10-29 09:21:02 | skrah | create | |
|