Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7233] decimal.py: two rotate() issues

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Oct 29, 2009, 2:21 AM

Post #1 of 6 (176 views)
Permalink
[issue7233] decimal.py: two rotate() issues

New submission from Stefan Krah <stefan-usenet [at] bytereef>:

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

----------
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>
<http://bugs.python.org/issue7233>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Oct 29, 2009, 2:23 AM

Post #2 of 6 (160 views)
Permalink
[issue7233] decimal.py: two rotate() issues [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Agreed on both counts. I'll take a look.

----------
assignee: -> mark.dickinson

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7233>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Oct 29, 2009, 3:46 AM

Post #3 of 6 (165 views)
Permalink
[issue7233] decimal.py: two rotate() issues [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

The shift function should also accept an integer 2nd argument.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7233>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Oct 29, 2009, 5:04 AM

Post #4 of 6 (158 views)
Permalink
[issue7233] decimal.py: two rotate() issues [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

There were a number of Decimal methods that failed to accept an integer
second argument. I've fixed that in r75944.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7233>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Oct 29, 2009, 5:11 AM

Post #5 of 6 (157 views)
Permalink
[issue7233] decimal.py: two rotate() issues [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

And the shift and rotate bugs for large arguments are fixed in r75945.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7233>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Oct 29, 2009, 5:25 AM

Post #6 of 6 (160 views)
Permalink
[issue7233] decimal.py: two rotate() issues [In reply to]

Mark Dickinson <dickinsm [at] gmail> added the comment:

Merged (along with a test numbering fix in extra.decTest) in r75946
(release26-maint), r75947 (py3k) and r75948 (release31-maint).

Thanks for the report!

----------
components: +Library (Lib)
priority: -> normal
resolution: -> fixed
stage: -> committed/rejected
status: open -> closed
type: -> behavior
versions: +Python 3.1, Python 3.2

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7233>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.