Accumath

Open source

zenith-float

Arbitrary-precision floating point done entirely in software. Free and open source, built by the Accumath team for the community.

About

Arbitrary-precision binary floating point computed entirely in software on integer limbs, plus software IEEE-754 single and double precision, complex numbers, exact rationals, arrays, and numerical-analysis routines. Published as three crates: zenith-float, zenith-float-num (the kernel), and zenith-float-macro.

Current version 1.0.10 · License MIT OR Apache-2.0

1.0.6 shipped the SoftFloat pack. 1.0.7 is compile-only: the unsafe wrappers stay, with unused_unsafe allowed — the _addcarry_u64/_subborrow_u64 intrinsics became safe functions in Rust 1.93. 1.0.8 fixes the release banner. No math changed in 1.0.7 or 1.0.8. 1.0.9 resizes the Bessel guard to fit the actual cancellation: a fixed 32-bit pad when every series term is positive, real Iν now runs past its series peak for large |x|, and real Kν uses the asymptotic series instead of erroring when the guard would exceed the cap. 1.0.10 adds SoftFloat Gauss-Kronrod (7, 15) quadrature with Wynn epsilon acceleration for finite-interval integrals — the QUADPACK design, recomputed in SoftFloat, no Fortran copied. Versions 1.0.0 through 1.0.4 are yanked.

zenith-float on crates.io · zenith-float-num on crates.io · zenith-float-macro on crates.io · Source on GitHub

Built and tested (1–26)

239 tests pass on version 1.0.9 (25 in zenith-float, 214 in zenith-float-num), including 15 differential tests that compare results bit for bit against MPFR, the standard reference library, and regression tests against mpmath reference values. The same reference cases also run without the standard library on a bare-metal ARM Cortex-M4F (in QEMU) and on Linux. An item is listed here only when it is built, has tests, and those tests pass.

  1. 1Arbitrary-precision floats with explicit precision and 7 rounding modes
  2. 2Correctly rounded add, subtract, multiply, and divide at any precision, bit-identical to MPFR
  3. 3Fast multiplication and division for large mantissas (Toom-2, Toom-3, FFT multiply, Newton reciprocal)
  4. 4Square root and cube root bit-identical to MPFR, plus nth roots
  5. 5exp, exp2, exp10, expm1, ln, log2, log10, and pow bit-identical to MPFR; log1p within 1 ulp
  6. 6sin, cos, tan, asin, acos, and atan bit-identical to MPFR, plus atan2, hypot, and argument reduction by π
  7. 7sinh, cosh, tanh, acosh, and atanh bit-identical to MPFR; asinh within 1 ulp
  8. 8Constants at any precision (π, e, ln 2, ln 10, Euler γ, √2, φ) with a cache shareable across threads
  9. 9Special functions: erf, erfc, gamma, log-gamma, digamma, incomplete gamma, Bessel, Airy, Ei, Si, Ci, li, Fresnel, elliptic integrals, Legendre, hypergeometric, incomplete beta, Jacobi elliptic
  10. 10Fused and compensated operations (fma, two-sum, two-product, fused sums and dot products, polynomial evaluation)
  11. 11Sign and exponent utilities (copysign, next_after, frexp, ldexp)
  12. 12Parse and print numbers in binary, octal, decimal, hex, and any radix, with exact round-trips
  13. 13Complex numbers with correct branch cuts, plus complex erf, gamma, Bessel, Airy, Ei, elliptic, and 2F1
  14. 14Exact big integers and rationals, checked against GMP
  15. 15Number theory on big integers (modular power and inverse, Miller-Rabin primality, Pollard-Brent factoring)
  16. 16Software IEEE-754 single and double precision, bit-exact, with SIMD-style lanes that match scalar results
  17. 17Arrays and linear algebra (element-wise math, matrix multiply, LU, QR, SVD, symmetric eigenvalues)
  18. 18FFT, DCT, DST, and window functions
  19. 19Numerical analysis: polynomial operations and roots, root finding (bisection, Newton, Brent, Illinois), quadrature (Gauss-Legendre, tanh-sinh, Laguerre, Hermite), ODE solvers (Euler, RK4, RK45), Chebyshev approximation, orthogonal polynomials
  20. 20Interval (ball) arithmetic with guaranteed enclosures and correct-rounding retries
  21. 21Probability distributions and random sampling
  22. 22Serialization: compact binary format, CSV, and JSON through serde
  23. 23expr! macro that evaluates a formula with extra working precision to absorb cancellation
  24. 24cexpr! macro for complex expressions
  25. 25Ordinary + − × ÷ operators with a 128-bit default and compile-time literals
  26. 26Tested no_std support: 77 reference-value tests run without the standard library, bare-metal on ARM Cortex-M4F (in QEMU) and on Linux with only libc

Still to build (27–29)

  1. 27Faster complex Bessel K for non-integer order at high precision (results are correct, but some 512-bit cases take over a minute)
  2. 28Real Bessel J and Y for arguments beyond about 10,000 (the complex versions already cover this range)
  3. 29Complex Bessel functions exactly on the negative real axis (a part that should be zero or very small can come back wrong, and some half-integer orders do not converge yet)

All open-source projects Buy a pre-release Accumath license — $25+