[Python-ideas] Python Numbers as Human Concept Decimal System
Mark H. Harris
harrismh777 at gmail.com
Fri Mar 7 23:18:57 CET 2014
On Friday, March 7, 2014 3:24:06 PM UTC-6, Andrew Barnert wrote:
>
> It is not possible to correctly promote a binary float to a decimal float.
> The decision (in Py2.7?)
> was to NOT throw an exception and to copy the binary float "exactly" into
> the decimal float.
>
>
> There is no such thing as copying a binary float exactly into a decimal
> float. Decimal float values are not a superset of binary float values; in
> either direction, you have to round. Which is what Python 2.7+ does.
>
>
Andrew, you are deliberately side-stepping the point. You apparently
disagree with Steven D, and others,
who have already stated repeatedly on this list that on 2.7+ binary float
literals are copies "exactly" to
decimal float representation! That is what is causing this entire problem,
sir. That is the reason for this:
>>> from decimal import Decimal
>>> Decimal(.1)
Decimal('0.1000000000000000055511151231257827021181583404541015625')
<====== this is not a rounding problem
>>>
It is a copy problem, and it should not be allowed. It was a bad decision
to approach the problem this
way, and the correct response to it is to not allow it, throw an exception,
and let the user fix it.
Otherwise, as I've stated earlier, there needs to be a policy that promotes
the binary floating point
representation to decimal floating point representation without the mess
from the 16th digit out.... and,
that may not be possible (needs to be discussed, and researched).
It is clear from Guido's response earlier this afternoon that he
understands the problem, and has some
good ideas for how to proceed. I am happy with that, and will keep
monitoring the news to see how
things go.
Thanks for your feedback.
marcus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140307/1e718cc8/attachment-0001.html>
More information about the Python-ideas
mailing list