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.

classification
Title: Update decimal module to version 1.68 of the IBM specification
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: facundobatista, mark.dickinson, rhettinger
Priority: critical Keywords: patch

Created on 2008-07-25 22:16 by mark.dickinson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue3449.patch mark.dickinson, 2008-07-26 08:47 Update test files for decimal module
Messages (8)
msg70284 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-07-25 22:16
The IBM General Decimal Arithmetic Specification, on which the decimal 
module is based, has recently been updated to version 1.68;  the 
testcases from IBM have also been updated.

The comments in the decimal module clearly state that the decimal module 
should be kept in sync with the IBM specification, and that deviation 
from the spec is considered a bug.  So it seems to me that the decimal 
module should be updated, preferably before 2.6 and 3.0 come out.

As far as I can tell the required changes should be minimal:  max-
magnitude and min-magnitude definitely need changing, and there may be 
other minor changes necessary to make the new tests pass; I haven't 
looked properly yet.  I'll try to get to this in the next few days.
msg70285 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-07-25 22:20
One change from v1.66 to v1.68 of the spec:

"""The normalize operation has been renamed reduce to avoid confusion with 
normal numbers."""

The decimal module is not under any obligation to use the same names as in 
the IBM specification, so I don't think we're required to rename 
Decimal.normalize to Decimal.reduce.  Does anyone think that we should 
rename this method?  I'm inclined not to rename.
msg70286 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-07-25 23:34
-0 to rename it, specially considering that we had a reduce builtin in
our history... better to not confuse it. But we'd need to convert the
name in the tests...
msg70287 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-07-26 00:07
-1 on renaming.  I concur with Mark that we are under no obligation to 
match the names used in the spec -- only the functionality matters -- 
also we're already got a history of at least slightly different names.  
I also see no reason to break existing code relying on the existing 
name.  I also agree with Facundo that the "reduce" name has a 
completely unrelated association in the Python langauge.
msg70288 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-07-26 00:09
P.S. I also agree with Mark that the 1.68 update should be treated as a 
bugfix and go into the next beta, preferably as soon as possible.  
Facundo and I should both agree to give it a quick and thorough review 
so that the beta is as solid as possible.
msg70292 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-07-26 08:46
Looks like the changes needed here are even more minor than I thought.

The decimal module already does the right thing with respect to
the new specification and the new tests.  So all that needs doing is
to replace the old tests with the new ones.  No changes to decimal.py
or test_decimal.py are necessary.

Here's a patch.
msg70308 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-07-27 00:53
The patch looks great, feel free to apply it and commit.

For the record: the name issue that Mark talked about is not in this
last change, it was before, and we handled it the way we now decide
(hey, at least we're coherent with ourselves, ;) ).

Thank you Mark!
msg70314 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-07-27 06:40
Fixed, r65257.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47699
2008-07-27 06:40:18mark.dickinsonsetstatus: open -> closed
resolution: fixed
messages: + msg70314
2008-07-27 00:53:23facundobatistasetmessages: + msg70308
2008-07-26 08:47:29mark.dickinsonsetfiles: + issue3449.patch
keywords: + patch
2008-07-26 08:46:17mark.dickinsonsetmessages: + msg70292
2008-07-26 00:09:43rhettingersetmessages: + msg70288
2008-07-26 00:07:14rhettingersetmessages: + msg70287
2008-07-25 23:34:46facundobatistasetmessages: + msg70286
2008-07-25 22:20:51mark.dickinsonsetmessages: + msg70285
2008-07-25 22:16:13mark.dickinsoncreate