[Python-ideas] Python Numbers as Human Concept Decimal System
Mark H. Harris
harrismh777 at gmail.com
Sat Mar 8 20:13:24 CET 2014
On Saturday, March 8, 2014 12:49:02 PM UTC-6, Mark Dickinson wrote:
- if we're aiming to eliminate surprises, the 'fix' doesn't go far enough:
> Decimal(1.1 + 2.2) will still surprise, as will {snip}
>
Correct. That is why a decimal literal notation is also needed. I've
emulated it here:
>>> from pdeclib import *
>>> sqrt(1.1+2.2)**2
Decimal('3.30000000000000026645352591003756970167159') <==== this is a
surprise, to a naive user
>>> sqrt(d(1.1)+d(2.2))**2
Decimal('3.29999999999999999999999999999999999999999') <=== this if
decimal literal,
>>>
sqrt(1.1d + 2.2d)
But, you are correct that what is "really" wanted --someday-- is to
have
the literal be decimal (rather than float) to begin with.
Neither here nor there, step at a time over time is better than simple
status quo.
Please let me be clear, I think Guido's proposal is a very good first step.
It makes
sense for the most users (esp naive ones) and does not interfere with
advanced users.
marcus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140308/b248c6e4/attachment.html>
More information about the Python-ideas
mailing list