Repository navigation
v0.4.17
I wasn't planning on releasing today, but after pishleback found a multiplication bug I wanted to push out a fix ASAP. I also released the partially-completed work that I've been doing on Malachite in the last few months.
- I rewrote a significant portion of malachite-float to exactly match the overflow and underflow behavior of MPFR. There are also explicit Float::MAX_EXPONENT and Float::MIN_EXPONENT constants now. This work is complete except for division of Floats by Floats, division of Floats by Rationals, division of Rationals by Floats, and multiplication of Floats by Rationals; I'll wrap that up soon. Note that all arithmetic operations worked perfectly well before this change, unless you were working with Floats whose absolute exponents are on the order of 1 billion.
- Malachite's integer multiplication code is translated from the corresponding code in FLINT. Since I first did that translation, Dan Schultz wrote a faster implementation for FLINT, and I've started working on incorporating a translation of that code into Malachite. It's not done yet, but it's already yielded one nice side benefit:
- Malachite now supports fast primality testing for primitive integers up to u64, also translated from FLINT's codebase; for example, after importing the
IsPrimetrait, you can write5509785649208481923u64.is_prime(), which evaluates totrue. I tested this function on hundreds of thousands of random u64s, and found that it completed in less than 1.5 milliseconds for every u64, whereas a naive approach based on trial division could take up to 1 second for a single u64. I will eventually implementIsPrimefor u128 andNaturalas well. - Converting primitive integers or primitive floats to
Floatnow creates aFloatwith the minimum precision necessary to represent the original value. Previously, some less obvious precision choices were made. If you want some precision other than the default, you can always useFloat::from_unsigned_prec,Float::from_unsigned_prec_round, etc. - There are various other improvements. For example, I added an
AbsDiffimplementation forRational.