Repository navigation
v0.12.0
This release adds every trigonometric and inverse trigonometric function, correctly rounded, to Float. It also adds two new complex types, GaussianInteger and GaussianRational.
Highlights
- Trigonometry for
Float:sin,cos,tan,sec,csc,cot, andsin_cos, with their inversesasin,acos,atan,atan2,asec,acsc, andacot. Each of the fourteen comes in six forms: aFloator aRationalangle, measured in radians, inuths of a turn (_with_period), or in half-turns (_pi), and each also has a correctly roundedf32/f64counterpart. This goes past MPFR, which has nosecu,cscu, orcotuto match itssinuandcosu, nopiscalings of the reciprocal trio, and noasec,acsc, oracotat all. Also new: the Dottie number, the fixed point of the cosine, to any precision. - Gaussian integers and rationals:
GaussianIntegerin malachite-nz andGaussianRationalin malachite-q, each a pair of publicrealandimaginaryfields. Arithmetic follows FLINT'sfmpzialgorithms (Karatsuba and double-word multiplication, exact division, Euclideandiv_remwith nearest-quotient rounding, GCD, powers, and exact square and nth roots) alongside canonicalization under the units ±1 and ±i, the full equality, ordering, and absolute-value comparison matrices against the real types, and a complete conversion matrix. Floatis now in themalachitecrate by default. Thefloatsfeature is on by default, soFloatand thefloatmodule are re-exported at the crate root. This costs nothing extra to compile:malachite-floatwas already built by every default build.- Performance:
sin,cos, andsin_cosuse the equivalent of MPFR's asymptotically fast binary-splitting tier at high precision, and multiplying any bignum by itself through aliased references (&x * &x) routes to the squaring algorithm. - New traits in malachite-base for complex arithmetic:
AbsSquared,Conjugate,MulI,DivI,MulIPow,IsGaussianInteger,IsReal,IsUnit,CanonicalizeUnit,CanonicalUnitIPow, theIandNegativeIconstants, andImaginaryFrom/ImaginaryInto, plusContentAndPrimitivePart,Content, andPrimitivePart.
Breaking and behavioral changes
PrimitiveIntandPrimitiveFloathave gained supertraits, so a type outside Malachite implementing either must now implement those too. Code that uses them only as bounds is unaffected, and gains the new methods on every primitive type.- The
malachitecrate enablesfloatsby default, so a glob import ofmalachitealongside anotherFloatis now ambiguous. - The
malachitecrate'sstd,random,enable_serde, and32_bit_limbsfeatures no longer drag the optional sub-crates into the build; each now configures whichever ofnaturals_and_integers,rationals, andfloatsis enabled, and those three build on one another.--no-default-featuresplus only a modifier feature now gets malachite-base alone.
See the full changelog for details.