[Python-ideas] Python Numbers as Human Concept Decimal System

Alexander Belopolsky alexander.belopolsky at gmail.com
Sun Mar 9 04:41:14 CET 2014


On Sat, Mar 8, 2014 at 10:15 PM, Steven D'Aprano <steve at pearwood.info>wrote:

> Of course not. Numeric surprises are like bubbles under wallpaper: you
> can push them around, move them from place to place, but you cannot
> eliminate them entirely. (The analogy is not perfect: with wallpaper,
> you can push the bubble out to the edge, and at least sometimes,
> eliminate it.)
>

Great analogy!  I'll start using it with wallpaper covering floor,
ceiling as well as all four walls.


>
> Since Q is based on APL, I'm guessing that the surprise here is
> actually in the = equals operator. Is it doing a fuzzy comparison?
>

Exactly.


> If so, that's also surprising, since that means you can have triplets of
> numbers such that a = b and b = c but a != c.
>

Yes, but such triplets are not  as easy to stumble upon as 1/3 + 1/3 + 1/3
and lack of transitivity is not something that novices are likely to
complain
about.

You are absolutely right about not being able to eliminate all bubbles, but
we can move them away from the center of the wall to the corners and under
the wall-pictures.

In my view

>>> Decimal(1.1)
Decimal('1.100000000000000088817841970012523233890533447265625')

is a big bubble right in the middle of the wall.

The most obvious conversion from float to Decimal should implement the most
commonly needed operation.  I cannot imagine anyone needing to convert
floats to 53-digit decimals in a real life application.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140308/30480e3a/attachment.html>


More information about the Python-ideas mailing list