[Python-ideas] Python Float Update
u8y7541 The Awesome Person
surya.subbarao1 at gmail.com
Fri Jun 5 04:12:31 CEST 2015
> But there was a big issue that we didn't anticipate. During the course of a
> simple program it was quite common for calculations to slow down
> dramatically, because numbers with ever-larger numerators and denominators
> were being computed (and rational arithmetic quickly slows down as those
> get bigger). So e.g. you might be computing your taxes with a precision of
> a million digits -- only to be rounding them down to dollars for display.
(Quote by Guido van Rossum)
> Decimal can still violate all the
> invariants that binary floats can. Binary has better approximation
> properties if you care about the *degree* of inexactness rather than
> the *frequency*[1] of inexactness. Fractions can quickly become very
> inefficient.
(Quote by Stephen J. Turnbull)
I have a solution. To add, we convert to decimal and then add, then
change back to fraction. If we have hard-to-represent decimals like 1
/ 3, we can add with numerators. Hybrid additions. This could really
speed up things...
--
-Surya Subbarao
More information about the Python-ideas
mailing list