title: How is Python's decimal (and other precise decimal libraries) implemented and why are they slower than built in floating point calculations?
body: <p>I've been reading the <a href="https://floating-point-gui.de/formats/exact/" rel="nofollow noreferrer">floating point guide</a> to try to clarify some points about floating point numbers and I assume Python's decimal library is an implementation of &quot;Limited-Precision Decimal&quot; mentioned on the linked page.</p>
  <p>It mentions that &quot;Limited-Precision Decimal&quot; is &quot;Basically the same as a IEEE 754 binary floating-point, except that the exponent is interpreted as base 10. As a result, there are no unexpected rounding errors. Also, this kind of format is relatively compact and fast, but usually slower than binary formats.&quot;</p>
  <p>Is Python <a href="https://docs.python.org/3/library/decimal.html" rel="nofollow noreferrer">decimal</a> implemented the same way? If all else is equal in the representation besides the exponent being interpreted differently, why is it slower and why isn't this representation always preferred over the IEEE 754 implementation? Finally, why does using the exponent as base 10 prevent unexpected rounding errors?</p>
  <p>Thanks!</p>