This script helps provide an intuitive understanding of how the precision of a number affects the result of
mathematical operations when using the decimal
module in Python. The script uses the pint
library to handle
conversion between units and the rich
library to display the results in a table format.
It starts with a set of example values that are converted to float
, decimal.Decimal
, and pint Quantity
(using decimals).
- The first output is a set of tables showing each of these example values rendered with different precision levels,