Decimo v0.8.0 is out on pixi — a big milestone 🔥

Hi Magicians and Pythonistas,

I’m happy to announce that Decimo (formerly DeciMojo) v0.8.0 is now available on pixi (via pixi add decimo)

VersionMojopixiLast Commit

For Pythonistas, decimo.BInt to Mojo is like int to Python, and decimo.Decimal to Mojo is like decimal.Decimal to Python.

Decimo v0.8.0 is a profound milestone in the development of Decimo, marking the “make it fast” phase. There are two major improvements in this release:

First, it introduces a completely new BigInt (BInt) type using a base-2^32 internal representation. This replaces the previous base-10^9 implementation (now available as BigInt10) with a little-endian format using UInt32 words, dramatically improving the performance of all integer operations. The new BigInt implements the Karatsuba multiplication algorithm and the Burnikel-Ziegler division algorithm for sub-quadratic performance on large integers, and includes divide-and-conquer base conversion for fast string I/O. It also adds bitwise operations, GCD and modular arithmetic, and an optimized integer square root. Benchmarks show that the new BigInt outperforms Python’s built-in int type in most cases.

Second, it optimizes the mathematical operations for BigDecimal, bringing significant performance and accuracy improvements. The sqrt() function is re-implemented using the reciprocal square root method combined with Newton’s method for faster convergence. The ln() function now supports an atanh-based approach with mathematical constant caching via MathCache. The exp() function benefits from aggressive range reduction for much faster convergence. The root() function gains rational root decomposition and a direct Newton method. The to_string() method is aligned with CPython’s decimal module formatting rules for scientific notation and trailing zeros. The BigUInt layer also gains the Toom-Cook 3-way multiplication algorithm.

For detailed changelogs, please see the release page:

2 Likes