[issue14245] float rounding examples in FAQ are outdated
report at bugs.python.org
Sat Mar 10 15:09:48 CET 2012
Zbyszek Szmek <zbyszek at in.waw.pl> added the comment:
On 03/10/2012 12:26 PM, Mark Dickinson wrote:
> Mark Dickinson<dickinsm at gmail.com> added the comment:
> Proposed rewrite:
thanks for the quick reply. If we were to rewrite the whole entry, some
more changes could be done:
I think it would be useful to mention explicitly that Python simply uses
the native floating-point implementation in hardware and thus behaves
very similarly to other languages which do this, for instance C or Java.
This should clear up a lot of the behaviour for people who know other
programming languages. "how the underlying platform handles
floating-point" says something very similar, but the reader needs to
understand what the "underlying platform" exactly is.
It is easy to count, that exactly 17 digits are accurate.
I have to admit, that I'm completely lost here --- why would a vastly
inaccurate number (with more than half of digits wrong) be ever stored?
If "1.2" is converted to a float (a C double in current implementation),
it has 15.96 decimal digits of precision.
"Similarly, the result of a floating-point operation must be rounded to
fit into the fixed precision, often resulting in another tiny error." ?
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list