Decimal can be Binary Too (was decimal or rational)

Andrew Stribblehill a.d.stribblehill at durham.ac.uk
Fri Jun 8 10:09:50 EDT 2001


"Tim Peters" <tim.one at home.com> writes:

<snip>
> ... For "typical" commercial use, the
> problem is that converting between base-2 (internal) and base-10 (string) is
> very expensive relative to the one or two arithmetic operations typically
> performed on each input.  For example, hook up to a database with a million
> sales records, and report on the sum.  The database probably delivers the
> sale amounts as strings, like "25017.18".  Even adding them into the total
> *as* strings would be cheaper than converting them to a binary format first.

Boo! I was hoping that by base-2 you were talking about base -2. We
don't need no steenkeeng two's complement.

-- 
Andrew Stribblehill
Systems programmer, IT Service, University of Durham, England



More information about the Python-list mailing list