decimojo

DeciMojo changelog

This is a list of RELEASED changes for the DeciMojo Package.

01/08/2025 (v0.4.2)

🛠️ Fixed

Fix a bug for BigUInt comparison: When there are leading zero words, the comparison returns incorrect results (#97).

01/07/2025 (v0.4.1)

Version 0.4.1 of DeciMojo introduces implicit type conversion between built-in integral types and arbitrary-precision types.

⭐️ New

Now DeciMojo supports implicit type conversion between built-in integeral types (Int, UInt, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128,UInt128, Int256, and UInt256) and the arbitrary-precision types (BigUInt, BigInt, and BigDecimal). This allows you to use these built-in types directly in arithmetic operations with BigInt and BigUInt without explicit conversion. The merged type will always be the most compatible one (PR #89, PR #90).

For example, you can now do the following:

from decimojo.prelude import *

fn main() raises:
    var a = BInt(Int256(-1234567890))
    var b = BigUInt(31415926)
    var c = BDec("3.14159265358979323")

    print("a =", a)
    print("b =", b)
    print("c =", c)

    print(a * b)  # Merged to BInt
    print(a + c)  # Merged to BDec
    print(b + c)  # Merged to BDec
    print(a * Int(-128))  # Merged to BInt
    print(b * UInt(8))  # Merged to BUInt
    print(c * Int256(987654321123456789))  # Merged to BDec

    var lst = [a, b, c, UInt8(255), Int64(22222), UInt256(1234567890)]
    # The list is of the type `List[BigDecimal]`
    for i in lst:
        print(i, end=", ")

Running the code will give your the following results:

a = -1234567890
b = 31415926
c = 3.14159265358979323
-38785093474216140
-1234567886.85840734641020677
31415929.14159265358979323
158024689920
251327408
3102807559527666386.46423202534973847
-1234567890, 31415926, 3.14159265358979323, 255, 22222, 1234567890,

🦋 Changed

Optimize the case when you increase the value of a BigInt object in-place by 1, i.e., i += 1. This allows you to iterate faster (PR #89). For example, we can compute the time taken to iterate from 0 to 1_000_000 using BigInt and compare it with the built-in Int type:

from decimojo.prelude import *

fn main() raises:
    i = BigInt(0)
    end = BigInt(1_000_000)
    while i < end:
        print(i)
        i += 1
scenario Time taken
v0.4.0 BigInt 1.102s
v0.4.1 BigInt 0.912s
Built-in Int 0.893s

🛠️ Fixed

Fix a bug in BigDecimal where it cannot create a correct value from a integral scalar, e.g., BDec(UInt16(0)) returns an unitialized BigDecimal object (PR #89).

📚 Documentation and testing

Update the tests module and refactor the test files for BigUInt (PR #88).

25/06/2025 (v0.4.0)

DeciMojo v0.4.0 updates the codebase to Mojo v25.4. This release enables you to use DeciMojo with the latest Mojo features.

06/06/2025 (v0.3.1)

DeciMojo v0.3.1 updates the codebase to Mojo v25.3 and replaces the magic package manager with pixi. This release enables you to use DeciMojo with the latest Mojo features and the new package manager.

15/04/2025 (v0.3.0)

DeciMojo v0.3.0 introduces the arbitrary-precision BigDecimal type with comprehensive arithmetic operations, comparisons, and mathematical functions (sqrt, root, log, exp, power). A new tomlmojo package supports test refactoring. Improvements include refined BigUInt constructors, enhanced scale_up_by_power_of_10() functionality, and a critical multiplication bug fix.

⭐️ New

🦋 Changed

🛠️ Fixed

01/04/2025 (v0.2.0)

Version 0.2.0 marks a significant expansion of DeciMojo with the introduction of BigInt and BigUInt types, providing unlimited precision integer arithmetic to complement the existing fixed-precision Decimal type. Core arithmetic functions for the Decimal type have been completely rewritten using Mojo 25.2’s UInt128, delivering substantial performance improvements. This release also extends mathematical capabilities with advanced operations including logarithms, exponentials, square roots, and n-th roots for the Decimal type. The codebase has been reorganized into a more modular structure, enhancing maintainability and extensibility. With comprehensive test coverage, improved documentation in multiple languages, and optimized memory management, v0.2.0 represents a major advancement in both functionality and performance for numerical computing in Mojo.

⭐️ New

🦋 Changed

❌ Removed

🛠️ Fixed

📚 Documentation and testing