Releases: mhogrefe/malachite
v0.4.7
v0.4.6
Implemented Float
addition and subtraction. The code is derived from MPFR and is highly optimized (which is one reason it took so long). The is functionality for providing a rounding mode, an output precision, or both. The defaults are RoundingMode::Nearest
and the maximum precision of the inputs. There are also implementations for adding and subtracting a Float
and a Rational
; any numeric type apart from Rational
can be losslessly converted to Float
, so there are no implementations for e.g. Float + Natural
, though in principle such an implementation could still be worthwhile since it would save some memory usage.
Next up: Float multiplication, squaring, and bit shifting (that is, multiplication and division by powers of 2).
v0.4.5
Various minor improvements.
- Malachite is now
no_std
, unless therandom
,test_build
, orbin_build
features are enabled. Thanks to shekohex for initiating this work! - As suggested by amamic1803, a
twos_complement_limb_count
method has been added toInteger
. - As pointed out by amamic1803, the
malachite
meta-crate did not have a32_bit_limbs
feature to propagate to its sub-crates. Now it does, along with arandom
feature. - I wrote a comment auto-formatter, eliminating the time I spend manually formatting comments. The newly-formatted comments account for most of the diff.
Integer
now implementsCheckedDiv
.Natural
now implementsPartialOrdAbs
for primitive floats. I added some tests for theAbsDiff
trait inmalachite-base
in preparation for implementing it forNatural
,Integer
, andRational
.- The random
Float
generators were producing floats whose exponents were off by 1. That has been fixed.
Most of my work in the last few months has been implementing addition and subtraction for Float
s. This is a lot less trivial than it sounds, because I'm translating MPFR's code, which is very optimized and has many special cases for addition and subtraction. Counterintuitively, implementing more advanced functions will take less time. I'm wrapping up the addition and subtraction work, so that will be released soon.
0.4.4
v0.4.3
- Fixed the multiplication bug described in #29.
- Improved
Natural
(and by extension,Integer
andRational
) parsing according to the suggestion in #27. - Added an optional
random
feature; see #26. - Modular arithmetic functions now panic when the inputs are not reduced. Previously, the documentation warned the user that reduced inputs are expected, but the behavior was unspecified when the inputs were not reduced.
CheckedDiv
implemented forNatural
. It was already implemented forRational
, and soon I'll add anInteger
implementation as well.
v0.4.2
This release adds several const
functions that can be used to initialize Natural
s, Integer
s, and Rational
s:
Natural::const_from_unsigned
Integer::const_from_unsigned
Integer::const_from_signed
Rational::const_from_unsigned
Rational::const_from_signed
Rational::const_from_unsigneds
Rational::const_from_signeds
The last two functions construct a Rational
from a numerator and denominator. They use a const
GCD function to reduce their arguments.
I'm continuing to work on a larger release that will include Float
addition and subtraction, among other things.
v0.4.1
v0.4.0
- I created the
malachite-float
crate and theFloat
type.Float
s are currently very incomplete; hardly any arithmetic is implemented yet. However, there is a full complement of functions for comparison and conversion between betweenFloat
s and other numeric types. Those functions are extensively tested and documented. But note that the current functions for converting to and from strings are not stable; eventually I will implement them in a way that matches MPFR's behavior, but that requires division and logarithms, which are not yet implemented. - Most functions that take a
RoundingMode
now also return anOrdering
indicating whether the rounded value is less than, greater than, or equal to the notional exact value. If you currently use these functions (for example,rounding_from
orshr_round
), you may need to append an.0
after the function call to extract the rounded value and ignore theOrdering
. - We have some features from new contributors!
- b4D8 implemented the
One
,Two
, andNegativeOne
traits forNonZero*
types. - segfault87 implemented
CheckedDiv
forRational
s. In the next release I'll implement it forNatural
s andInteger
s as well.
- b4D8 implemented the
- Malachite used to have an
Iverson
trait for the Iverson bracket, which converts booleans to numbers. I replaced this withFrom<bool>
everywhere once I realized that it was already implemented for primitive integers. - Bugfixes:
LimbIterator
behaved incorrectly (Issue 18). Although it was thoroughly tested like all of Malachite's features, I didn't realize what the correct behavior should have been when I originally wrote the tests. Thanks to qingshi163 for catching this.Natural::from_string_base
did not always fail when it should have (Issue 20). There was a small gap in the testing;from_string_base
's behavior on valid strings was well-tested, but its behavior on invalid strings was not. Thanks to qingshi163 for catching this one as well.