Against PEP 240
nperkins7 at home.com
Thu May 31 20:37:53 CEST 2001
"Laura Creighton" <lac at cd.chalmers.se> wrote in message
news:mailman.991303187.29241.python-list at python.org...
> "Nick Perkins" <nperkins7 at home.com>:
> >On the other hand, the current system has never bothered me. I enjoy
> >tiny inaccuracies hidden from me. It all depends on coming to peace with
> >the idea that a float is just a number that is very close to the number
> >I want it to be.
> The only thing necessary for the triumph of evil is for good men to do
> - Edmund Burke (1729-1797)
..remember, that was the 'other' hand.
..my first hand (not quoted) was saying that a Decimal type seems right for
The current system never bothered me because I was used to floats before
coming to Python, and did not suffer the 'surprise' in question.
At this point in the discussion, I am more interested in the distinction
between a Decimal type and a Rational type.
BTW, I have seen the term BCD thrown around, (Binary Coded Decimal)...
Years ago I learned about BCD being a system that codes 2 decimal digits per
Is this still what is meant by BCD?
I would think that a modern 'Decimal' type would not use this, but something
more like base*10^exp, where base and exp are stored as binary integers.
One the one hand, (thank god i have 2), Decimals can represent literal
numbers quite nicely, and would probably (maybe) be faster than Rationals
for computations that are closed under such a system (*,+,-), but would
choke on eg: (7.35/3), which a Rational could do easily.
On the other hand, even Rationals would choke on sqrt(7.35).
If Rationals were default, what would result from sqrt(7.35), or cos(7.35)?
It seems that although floats are often inaccurate, at least they are closed
under all known computations.
Basically, I can't seem to make up my mind on this issue.
I do, in principle agree with Alex's mantra: " 7.35 should mean 7.35 ".
(on the other hand)...
Modern CPU-FPU operations are going to be way faster than any other system:
what about newbies wondering "why are my calculations so slow?"
More information about the Python-list