Skip to content

v0.4.16

Compare
Choose a tag to compare
@mhogrefe mhogrefe released this 05 Sep 05:00
· 97 commits to master since this release

This release adds efficient Float division, as well as efficient multiplication of Floats by Rationals, division of Floats by Rationals, and division of Rationals by Floats. Conversion from Rationals to Floats is also more efficient, because it now uses Float division. The Reciprocal trait, and related functions, are also now implemented for Floats. Taking the reciprocal with these functions is slightly faster than computing 1/x using the division functions.

Now that the four basic arithmetic functions are supported for Floats, I'm able to move on to more interesting functions. Apart from the square root function and efficient string conversion functions, the functions that have yet to be implemented have simpler implementations in MPFR than the functions that have already been translated for Malachite, so you can generally expect the development of Floats to speed up a bit.

Other changes include

  • Float::from_natural_min_prec and related functions, which convert from Naturals or Integers to Floats using the minimum precision necessary.
  • Float::from_natural_prec_round_ref is now smarter: if converting from a large Natural with low precision, only the few most-significant bits that are needed are copied.
  • More Float functions are now tested against the rug library.
  • Some more random Natural, Integer, and Rational generators are added.
  • Two nontrivial Float constants are added (not actually constants, since you need to specify a precision and optionally a rounding mode). They are the prime constant and the Thue-Morse constant. They're not very useful; I just added them because I like constants. More useful constants are coming soon!