ANN: Decimal.py 0.0.0
Niki Spahiev
spahievi at vega.bg
Sat May 19 12:45:49 EDT 2001
18.5.2001, 19:20:22, Aahz Maruch wrote:
AM> I've just finished stage one, addition and subtraction. Stage two is
AM> conversion routines, multiplication, and unit tests. Stage three is
AM> division. Right now, I'm just throwing this out in case anyone really
AM> wants decimal arithmetic badly enough to try testing this; I don't
AM> expect serious testing until I finish stage two.
AM> I'm not looking for any design critiques right now, just bug reports.
AM> Decimal.py:
AM> '''
AM> This is a first stab at a decimal arithmetic module based on the decimal
AM> arithmetic ANSI standard X3.274-1996. It should work with Python 1.5.2
AM> and later.
AM> Most of the information used to create this module was helpfully provided
AM> by Mike Cowlishaw's work at
AM> http://www2.hursley.ibm.com/decimal/
AM> The rest comes from Tim Peters' FixedPoint.py, particularly the string
AM> conversion routine.
AM> In the current form of Decimal(), precision is finite but unbounded, with
AM> the exception of division. You must use the round() method to perform
AM> any trimming.
AM> Currently, the only way to create a Decimal instance is with a tuple
AM> containing the necessary values. Element zero is the sign, element one
AM> is a tuple containing the digits of the integer portion, and element
AM> three is the exponent (an int). For example:
1 =>> (0, (1,), 0)
-.0123 =>> (1, (1,2,3), -5)
AM> '''
Why not long instead of tuple?
--
Best regards,
Niki Spahiev
More information about the Python-list
mailing list