Message 336874 - Python tracker (original) (raw)
Aiden: in the future, please do not post unnecessary screenshots of text. They are hostile to the blind and slight-impaired, they make it impossible to copy your code and run it ourselves, and they cannot be searched for.
Instead, copy and paste the text demonstrating the code and the results:
py> 11/3 3.6666666666666665
Thank you.
Zachary: while the rest of your comments were excellent, please don't tell people that Decimal is "exact". Decimal is a floating point format just like floats are, and so suffers the same kinds of rounding errors as binary floats. In fact, Decimal often suffers from larger rounding errors than binary, which is why serious numeric data scientists still use binary float.
The advantages of Decimal over binary float is that you can configure how much precision is used, and that any number you can write out exactly in base 10 can be represented exactly as a Decimal. But it still has to round off values which cannot be represented exactly as Decimals.