[Python-Dev] Expert floats
python-dev at zesty.ca
Tue Mar 30 12:50:46 EST 2004
On Tue, Mar 30, 2004, Edward Loper wrote:
> But I'm not particularly happy about the fact that you have to be an
> expert to understand the intricacies of basic arithmetic with floats
> (not that I have a way to fix it).
On Tue, 30 Mar 2004, Aahz wrote:
> >>> 1.1
> Just a fact of life. :-/
I regret that this "feature" was ever introduced or "fixed" or what have
you. Things were much better when repr(1.1) was "1.1" a few versions ago.
This inconsistency is strange and surprising to every Python learner and
I still believe there is no good reason for it. The motivation, as i
remember it, was to make repr(x) produce a cross-platform representation
of x. But no one uses repr() expecting bit-for-bit identity across
platforms. repr() can't even represent most objects; if you want to
transfer things between platforms, you would use pickle.
If typing in "1.1" produces x, then "1.1" is a perfectly accurate
representation of x on the current platform. And that is sufficient.
Showing "1.1000000000000001" is a clear case of confusing lots of people
in exchange for an obscure benefit to very few. If i could vote for
just one thing to roll back about Python, this would be it.
More information about the Python-Dev