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.

Author mark.dickinson
Recipients facundobatista, mark.dickinson, ncoghlan
Date 2008-03-25.21:36:13
SpamBayes Score 0.006457047
Marked as misclassified No
Message-id <1206480975.35.0.923616350386.issue2486@psf.upfronthosting.co.za>
In-reply-to
Content
The Python 3.0 version of decimal.py currently stores the coefficient of
a Decimal number (or the payload of a NaN) as a string, all of whose
characters are in the range '0' through '9'.

It may be more time-efficient to store the coefficient as a bytes 
instance instead, since bytes -> int conversion is likely to be faster 
than str -> int conversion.  On the other hand, int -> bytes conversion 
has to go through str, so may be significantly slower than int -> str 
conversion...

Bottom line:  this needs testing.

One other option:  it may even be worth considering storing the 
coefficient directly as a Python integer.  I've argued against this 
before, on the basis that it makes direct access to the decimal digits 
of a number harder, and this direct access is useful for rounding as 
well as for some of the more esoteric Decimal operations (logical 
operations, shifts and rotations).  But it may be worth a look.

(I think it's clear what the *right* option is, given unlimited 
developer time and energy:  decimal.py should represent the coefficient 
using a long integer implementation written in C, with wordsize a power 
of 10---probably either 10**4 or 10**9.)

See related discussion at issue 2482 and at

http://mail.python.org/pipermail/python-dev/2008-March/078189.html
History
Date User Action Args
2008-03-25 21:36:15mark.dickinsonsetspambayes_score: 0.00645705 -> 0.006457047
recipients: + mark.dickinson, facundobatista, ncoghlan
2008-03-25 21:36:15mark.dickinsonsetspambayes_score: 0.00645705 -> 0.00645705
messageid: <1206480975.35.0.923616350386.issue2486@psf.upfronthosting.co.za>
2008-03-25 21:36:14mark.dickinsonlinkissue2486 messages
2008-03-25 21:36:13mark.dickinsoncreate