[New-bugs-announce] [issue10650] decimal.py: quantize(): excess digits with watchexp=0
Stefan Krah
report at bugs.python.org
Wed Dec 8 14:56:15 CET 2010
New submission from Stefan Krah <stefan-usenet at bytereef.org>:
I'm not sure if this is a documentation issue or a bug. If watchexp=0,
quantize() also allows any number of digits:
>>> x = Decimal("6885998238912213556789006667970467609814")
>>> y = Decimal("1e2")
>>> x.quantize(y)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/decimal.py", line 2488, in quantize
'quantize result has too many digits for current context')
File "/usr/local/lib/python3.2/decimal.py", line 3925, in _raise_error
raise error(explanation)
decimal.InvalidOperation: quantize result has too many digits for current context
>>>
>>> x.quantize(y, watchexp=0)
Decimal('6.8859982389122135567890066679704676098E+39')
----------
components: Library (Lib)
messages: 123603
nosy: mark.dickinson, rhettinger, skrah
priority: normal
severity: normal
status: open
title: decimal.py: quantize(): excess digits with watchexp=0
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10650>
_______________________________________
More information about the New-bugs-announce
mailing list