- Upgrade to 2021 edition, MSRV 1.60
- Add
Ratio::approximate_float_unsigned
to convertFloatCore
types to unsigned - Add
const ZERO
andONE
, and implementnum_traits::ConstZero
andConstOne
- Add
Ratio::into_raw
to deconstruct the numerator and denominator
Contributors: @cuviper, @Enyium, @flavioroth, @waywardmonkeys
- Fewer
clone
calls are used when reducing a newRatio<T>
. - Conversions to floating point are better at avoiding underflow.
Ratio<T>
now implementsDefault
, returning a zero value.
Contributors: @cuviper, @lemmih, @MattX
- The optional
num-bigint
dependency is now 0.4. - The
Rational
alias forRatio<usize>
is now deprecated. It is recommended to use specific type sizes for numeric computation, likeRational32
andRational64
.
Contributors: @cuviper, @vks
Contributors: @Nemo157
- Handle to_f64() with raw division by zero.
- Better document panic behaviour.
- Clarify the license specification as "MIT OR Apache-2.0".
Contributors: @cuviper, @zetok
Ratio
now implementsToPrimitive
.Ratio
now implements additional formatting traits:Binary
,Octal
,LowerHex
,UpperHex
,LowerExp
,UpperExp
- The
Pow
implementations have been expanded.Pow<BigInt>
andPow<BigUint>
are now implemented.Pow<_> for &Ratio<T>
now uses&T: Pow
.- The inherent
pow
method now uses&T: Pow
.
num-rational
now requires Rust 1.31 or greater.- The "i128" opt-in feature was removed, now always available.
- The "num-bigint-std" feature replaces "bigint" with
std
enabled.- The "num-bigint" feature without
std
usesalloc
on Rust 1.36+.
- The "num-bigint" feature without
Contributors: @cuviper, @MattX, @maxbla
- Fixed
CheckedDiv
when both dividend and divisor are 0. - Fixed
CheckedDiv
withmin_value()
numerators.
Ratio
now performs earlier reductions to avoid overflow with+-*/%
operators.Ratio::{new_raw, numer, denom}
are nowconst fn
for Rust 1.31 and later.- Updated the
autocfg
build dependency to 1.0.
Contributors: @cuviper, @dingelish, @jimbo1qaz, @maxbla
Contributors: @cuviper, @ignatenkobrain, @vks
- Maintenance release to fix
html_root_url
.
Ratio
now implementsOne::is_one
and theInv
trait.Ratio
now implementsSum
andProduct
.Ratio
now supportsi128
andu128
components with Rust 1.26+.Ratio
now implements thePow
trait.
num-rational
now requires rustc 1.15 or greater.- There is now a
std
feature, enabled by default, along with the implication that building without this feature makes this a#![no_std]
crate. A few methods now requireFloatCore
instead ofFloat
. - The
serde
dependency has been updated to 1.0, andrustc-serialize
is no longer supported bynum-rational
. - The optional
num-bigint
dependency has been updated to 0.2, and should be enabled using thebigint-std
feature. In the future, it may be possible to use thebigint
feature withno_std
.
Contributors: @clarcharr, @cuviper, @Emerentius, @robomancer-or, @vks
- Maintenance release to update dependencies.
- num-rational now has its own source repository at rust-num/num-rational.
Ratio
now implementsCheckedAdd
,CheckedSub
,CheckedMul
, andCheckedDiv
.Ratio
now implementsAddAssign
,SubAssign
,MulAssign
,DivAssign
, andRemAssign
with eitherRatio
or an integer on the right side. The non-assignment operators now also accept integers as an operand.Ratio
operators now make fewerclone()
calls.
Thanks to @c410-f3r, @cuviper, and @psimonyi for their contributions!
No prior release notes were kept. Thanks all the same to the many contributors that have made this crate what it is!