<div dir="ltr"><div dir="auto"><div>Hi all,<br><br></div><div>Please excuse me for getting a bit off-topic, but I would like<br></div><div>to point out that except for bean-counters who need to be<br></div><div>bug-compatible with accounting standards, decimal<br></div><div>floating point is generally a bad idea.<br><br></div><div>That is because the worst-case bound on the rounding error<br></div><div>grows linear with the base size. So you really want to choose<br></div><div>a base size as small as possible, i.e., 2.<br></div><div>This is not really related to the fact that computers use base-2<br></div><div>arithmetic, that is just a happy coincidence.<br></div><div>If we used ternary logic for our computers, FP should still be<br></div><div>based on base-2 and computer architects would complain<br></div><div>about the costly multiplication and division with powers of two<br></div><div>(just as they have historically complained about the costly<br></div><div>implementation of denormals, but we still got that, mostly<br></div><div>thanks to prof. Kahan convincing Intel).<br></div><div><br></div><div>Worse, a base other than 2 also increases the spread in the<br></div><div>average rounding error. This phenomenon is called "wobble"<br></div><div>and adds additional noise into calculations. <br><br></div><div>The ultimate problem is that the real number line contains<br></div><div>quite a few more elements than our puny computers can handle.<br></div><div>There is no 100% solution for this, but of all the possible<br></div><div>compromises, floating-point forms a fairly optimum point<br></div><div>in the design space for a wide range of applications.<br></div><div><br></div><div>Stephan<br></div><div><div class="gmail_extra"><br><div class="gmail_quote">Op 20 okt. 2017 3:13 p.m. schreef "Victor Stinner" <<a href="mailto:victor.stinner@gmail.com" target="_blank">victor.stinner@gmail.com</a>>:<br type="attribution"><blockquote class="m_1631518440708042208m_971341560814197995quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><div class="m_1631518440708042208m_971341560814197995elided-text">
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div></blockquote></div><br></div></div></div>
</div>