malachite
Arbitrary-precision arithmetic, with efficient algorithms partially derived from GMP, FLINT, and MPFR.
0.10.0
8.7M downloads/mo
#3360 most downloaded on crates.io
mhogrefe/malachite
What this package is like to depend on
Last release 28 days ago
27 Jul 2026
Release timing varies
gaps range from 2 weeks to 5 months
Some releases are documented
notes for 10 of 32 stable releases
4 versions withdrawn
withdrawn after publishing
4 years old
36 releases · first in 2022
7 releases in the last 12 months
see the full history below
Release timeline
36 releases · Oct 2022 to Jul 2026Releases
latest 36-
0.10.027 Jul 2026Release notes
Open source →With this release, Floats are no longer considered experimental! I've added
- A full complement of log, exp, and root functions
- Efficient conversions from Float to string and vice versa; with variants that match MPFR's conversion functions exactly, and variants which match Malachite's existing ToSci and FromSciString implementations
- A serde implementation for Float
- Many more Float constants, computable to any level of precision
- general performance improvements across Malachite
- 35 new Malachite-specific lints, to preserve Malachite's coding standards as it continues to grow
In the process of porting MPFR functions to Malachite, I discovered several bugs in MPFR. I've reported them and they're being fixed.
What's next:
- Filling in gaps (functions that other libraries support, but Malachite doesn't yet)
- The remaining MPFR functions, most notably the trigonometric functions
- Complex floats via MPC, to give Malachite complete parity with rug
- And much more!
-
0.9.219 Jun 2026Release notes
Open source →- Many log functions for Floats
- More Float constants
- Euclidean division for primitive ints, Naturals, and Integers
- Various other improvements and additions
-
0.9.101 Feb 2026Release notes
Open source →This release advances
Floatdevelopment.- AGM (the arithmetic-geometric mean) is now supported. It might seem odd to implement this obscure function before many elementary functions, but it turns out that the AGM is useful in computing logarithms, which will be the subject of the next release. Malachite also provides functionality for taking the AGM of two
Rationalsand returning aFloatresult. - Malachite is now able to compute pi to arbitrary precision. (If you want to benchmark this, beware that the current Float-to-decimal-string conversion is very slow; this will be fixed within the next few months.) Malachite also provides all the pi-related constants that std provides here.
- Malachite can now also compute Gauss's constant and the lemniscate constant to arbitrary precision.
- Rationals now have implementations for the
Remtrait (andModandCeilingMod, just likeIntegers). We definex % yto bex - y * sign(x * y) * floor(|x/y|), though the implementaton is slightly faster than the naive one.
- AGM (the arithmetic-geometric mean) is now supported. It might seem odd to implement this obscure function before many elementary functions, but it turns out that the AGM is useful in computing logarithms, which will be the subject of the next release. Malachite also provides functionality for taking the AGM of two
-
0.9.030 Dec 2025Release notes
Open source →This release adds functionality for taking the square root of Floats, and for taking the reciprocal square root of Floats (that is, raising them to the power of -1/2). It also adds several new constants that may be computed to arbitrary precision. Also, thanks to Dasaav-dsv for adding the
as_limbs_ascfunction to Naturals, allowing users to take a reference to a Natural's limbs.Breaking changes:
- The Thue-Morse constant is now called the Prouhet-Thue-Morse constant
- Natural logarithms are now called ln, not log
2026 will be a big year for Floats!
-
0.8.005 Dec 2025Release notes
Open source →- Float * Rational, Float / Rational, and Rational / Float now have correct overflow and underflow behavior; now all Float functions do, except for string conversion, which will be rewritten.
- The natural logarithm of 2 is now available as
Float::log_2_precandFloat::log_2_prec_round. - Floats now have a full complement of EqAbs implementations. Existing EqAbs and PartialOrdAbs implementations throughout Malachite have been cleaned up. Primitive unsigned integers no longer implement these traits, which is a breaking change. (If you were using these for some reason, just use normal comparison operators instead).
- Thanks to Will Youmans for implementing IsPower and ExpressAsPower for Naturals. I ported these implementations to u128 as well.
-
0.7.117 Nov 2025Release notes
Open source →- Division of Floats by Floats and reciprocation of Floats now handle overflow and underflow correctly (same as MPFR)
- There's now a full collection of shl and shr functions on Floats that accept precision, rounding mode, or both
- Factorial bug fixed
- Multiplication of very large integers could cause a stack overflow; this is now fixed
-
0.7.028 Sep 2025Release notes
Open source →I've rewritten integer multiplication a second time. The latest implementation is derived from Daniel Schultz's small-prime FFT multiplication implementation in FLINT. It's considerably faster than before, though still a bit slower than GMP's implementation. Malachite now depends on the wide crate for SIMD; once wide 0.8.0 is released, I should be able to improve Malachite's multiplication performance further still. I'm going to hold off making concrete performance claims until then.
Unfortunately, I've discovered that, at least on my machine, Malachite is considerably slower when built using no_std (though still pretty fast!); the main culprit is the
libm::fmafunction, which is considerably slower than the std-only equivalentmul_add. Since I want Malachite to have the best performance possible by default, I've decided to make no_std opt-in. Malachite will build with anstdfeature by default, and to build it with no_std you will need to disable default features.Thanks to Will Youmans for implementing some functions around perfect powers, and to all the other contributors to this release.
Next I will focus my attention back on
Floats, which have been neglected. -
0.6.106 Jun 2025 -
0.6.018 Apr 2025Release notes
Open source →- Upgraded to a more recent version of itertools. This caused a name collision between the new
getfunction on theItertoolstraits and variousgetfunctions on some iterators in Malachite. To resolve this, the Malachite functions were renamed toget_digitorget_limb, depending on the iterator. This is a breaking change. - Thanks to coolreader18 for removing a transitive dependency on the
syncrate inmalachite-bigint. - Thanks to twizmwazin for updating the pyo3 version.
- Various improvements caught by Clippy.
- Upgraded to a more recent version of itertools. This caused a name collision between the new
-
0.5.102 Mar 2025Release notes
Open source →- upgraded to Rust 2024 edition
- updated hashbrown dependency
- added primitive root computation for a prime number of primitive int type
-
0.5.017 Feb 2025Nothing published for this version
-
0.4.2203 Feb 2025Nothing published for this version
-
0.4.2130 Jan 2025 withdrawnNothing published for this version
-
0.4.2030 Jan 2025 withdrawnNothing published for this version
-
0.4.1930 Jan 2025 withdrawnNothing published for this version
-
0.4.1825 Jan 2025Nothing published for this version
-
0.4.1605 Sep 2024Nothing published for this version
-
0.4.1518 Aug 2024Nothing published for this version
-
0.4.1422 Jun 2024Nothing published for this version
-
0.4.1313 Jun 2024Nothing published for this version
-
0.4.1204 Jun 2024Nothing published for this version
-
0.4.1102 Jun 2024Nothing published for this version
-
0.4.1031 May 2024Nothing published for this version
-
0.4.922 May 2024Nothing published for this version
-
0.4.820 May 2024Nothing published for this version
-
0.4.712 Apr 2024Nothing published for this version
-
0.4.604 Apr 2024Nothing published for this version
-
0.4.512 Feb 2024Nothing published for this version
-
0.4.429 Oct 2023Nothing published for this version
-
0.4.328 Oct 2023 withdrawnNothing published for this version
-
0.4.211 Oct 2023Nothing published for this version
-
0.4.121 Sep 2023Nothing published for this version
-
0.4.003 Sep 2023Nothing published for this version
-
0.3.220 Jan 2023Nothing published for this version
-
0.3.122 Dec 2022Nothing published for this version
-
0.3.018 Oct 2022Nothing published for this version