Skip to content

Releases: Spellbound-Mojo/apn_mojo

APN Mojo 1.0.1

Choose a tag to compare

@anatolvitold anatolvitold released this 10 Oct 10:10

APN Mojo 1.0.1 makes Integer text in bases other than 10 fast for large values.

  • Bases 2, 4, 8, 16 and 32 format and parse in linear time. A 64 KiB integer prints in hexadecimal in 0.32 ms instead of 8.7 s, and in binary in 1.3 ms instead of 47 s.
  • Other bases work in chunks of as many digits as fit in 64 bits, about 25 times faster on large values. Decimal output under ConversionLimits takes the same path (10.9 s → 0.22 s at 64 KiB). Plain decimal text is unchanged.
  • Integer.to_bytes and Integer.from_bytes exchange the magnitude as bytes, in either byte order, in linear time.

The algorithms and measurements are in Exact text; the new methods are under Text and bytes.

Works with Mojo 1.1.x on Linux x86-64 and macOS arm64.

Install from the Modular community channel:

# pixi.toml
[workspace]
channels = ["https://conda.modular.com/max", "https://repo.prefix.dev/modular-community", "conda-forge"]
pixi add apn_mojo

Documentation: https://spellbound-mojo.github.io/apn_mojo/

APN Mojo 1.0.0

Choose a tag to compare

@anatolvitold anatolvitold released this 07 Oct 01:25

The first release of APN Mojo: arbitrary-precision numbers for Mojo 1.1, in pure Mojo with no runtime dependency on GMP, MPFR, MPC or Python.

  • Exact numbers: Integer and Rational of any size, with bit operations, roots, modular arithmetic, primality tests, factorials and binomials, and ExactComplex with rational parts.
  • Correctly rounded floating point: Float and Complex at any precision and exponent range, each result rounded once in any of five rounding modes, with traps per call. Elementary and special functions (gamma, zeta, error functions, Lambert W, hypergeometric functions and more) are correctly rounded too.
  • Guaranteed bounds: Ball and ComplexBall midpoint-radius arithmetic that carries input uncertainty and rounding error, with set operations and certified conversion to rounded values.
  • Arrays: Batch[T] for every number type, with views, masks, broadcasting, NumPy-style batch.* functions and reductions, vmap and lift to map scalar functions over arrays, and multithreaded evaluation.
  • Interchange: decimal, hexadecimal and binary text, format-preserving JSON, and conversion to and from native Mojo numbers.

Works with Mojo 1.1.x on Linux x86-64 and macOS arm64.

Install: the Modular community channel carries APN Mojo 1.0.1 instead of this version; its notes show how to install it.

Documentation: https://spellbound-mojo.github.io/apn_mojo/