decimal

decimal — Decimal fixed point and floating point arithmetic

New in version 2.4.

The decimal module provides support for decimal floating point arithmetic. It offers several advantages over the float datatype:

  • Decimal “is based on a floating-point model which was designed with people in mind, and necessarily has a paramount guiding principle – computers must provide an arithmetic that works in the same way as the arithmetic that people learn at school.” – excerpt from the decimal arithmetic specification.
  • Decimal numbers can be re