Part II — Decimal
Overview (Decimal)
Decimal is an arbitrary-precision decimal type — the Mojo-native equivalent of
Python’s decimal.Decimal. It can represent numbers with unlimited digits and
decimal places, making it suitable for financial modeling, scientific computing,
and applications where floating-point errors are unacceptable.
| Property | Value |
|---|---|
| Name | Decimal |
| Aliases | BigDecimal, BDec |
| Internal base | Base-10^18 (each word stores ≤ 18 digits) |
| Default precision | 28 significant digits |
| Python equivalent | decimal.Decimal |
Decimal, BigDecimal, and BDec are all the same type. We recommend
Decimal for consistency with Python’s decimal.Decimal.