4 ms·
> Decimal has all of the same rounding properties that binary floating point has This is not true. > Unlike hardware based binary floating point, the decimal
by cuteboy19 5y ago
> Decimal has all of the same rounding properties that binary floating point has
This is not true.
> Unlike hardware based binary floating point, the decimal module has a user alterable precision (defaulting to 28 places) which can be as large as needed for a given problem
> Both binary and decimal floating point are implemented in terms of published standards. While the built-in float type exposes only a modest portion of its capabilities, the decimal module exposes all required parts of the standard. When needed, the programmer has full control over rounding and signal handling. This includes an option to enforce exact arithmetic by using exceptions to block any inexact operations.
https://docs.python.org/3/library/decimal.html https://docs.python.org/3/library/decimal.html
- noobermin 5y agoI think they mean in the abstract. With a fixed precision, you have round-off error as long as you only have a fixed number of digits, and thus have all the attendant issues in computations with them.