Python “decimal” package gives wrong results
When you construct a Decimal from a floating-point number, you get the exact value of the floating-point number, which may not precisely match the decimal value because that’s how floating-point numbers work. If you want to do precise decimal arithmetic, construct your Decimal objects from strings instead of floating-point numbers: >>> Decimal(‘22.0’) / Decimal(‘10.0’) – … Read more