On Apr 8, 6:01 pm, Jonathan Gardner <[EMAIL PROTECTED]>
wrote:
> On Apr 8, 2:25 pm, Grzegorz S³odkowicz <[EMAIL PROTECTED]> wrote:
>
>
>
> > Isn't Decimal a BCD implementation?
>
> Yep, you are right and I am 
> wrong.http://www.python.org/dev/peps/pep-0327/#why-not-rational

Strictly speaking, BCD doesn't come into it:  the coefficient of a
Decimal instance is stored simply as a string of digits.  This is
pretty wasteful in terms of space:  1 byte per decimal digit
instead of the 4 bits per digit that BCD gives, but it's
convenient and fairly efficient.

An alternative representation that's gained popularity recently is
DPD (densely packed decimal), which packs 3 decimal digits into 10
bits in a clever way that allows reasonably efficient extraction
of any one of the 3 digits.  Decimal doesn't use this either. :)

Mark
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to