[New-bugs-announce] [issue7233] decimal.py: two rotate() issues

Stefan Krah report at bugs.python.org
Thu Oct 29 10:21:03 CET 2009

New submission from Stefan Krah <stefan-usenet at bytereef.org>:


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))

The result should be 0 (checked against decNumber).

messages: 94649
nosy: mark.dickinson, skrah
severity: normal
status: open
title: decimal.py: two rotate() issues
versions: Python 2.6, Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list