num-rational
Rational numbers implementation for Rust
0.4.2
357M downloads/mo
#313 most downloaded on crates.io
rust-num/num-rational
What this package is like to depend on
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.9 years
Most releases are documented
notes for 13 of 20 stable releases
1 version withdrawn
withdrawn after publishing
10 years old
21 releases · first in 2016
0 releases in the last 12 months
see the full history below
Release timeline
21 releases · Apr 2016 to Jan 2025Releases
latest 21-
0.4.208 May 2024Release notes
Open source →- Upgrade to 2021 edition, MSRV 1.60
- Add
Ratio::approximate_float_unsignedto convertFloatCoretypes to unsigned - Add
const ZEROandONE, and implementnum_traits::ConstZeroandConstOne - Add
Ratio::into_rawto deconstruct the numerator and denominator
Contributors: @cuviper, @Enyium, @flavioroth, @waywardmonkeys
-
0.4.123 Jun 2022Release notes
Open source →- Fewer
clonecalls 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
- Fewer
-
0.4.006 Mar 2021Release notes
Open source →- The optional
num-bigintdependency is now 0.4. - The
Rationalalias forRatio<usize>is now deprecated. It is recommended to use specific type sizes for numeric computation, likeRational32andRational64.
Contributors: @cuviper, @vks
- The optional
-
0.3.206 Nov 2020 -
0.3.130 Oct 2020Release notes
Open source →- 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
-
0.3.013 Jun 2020Release notes
Open source →Enhancements
Rationow implementsToPrimitive.Rationow implements additional formatting traits:Binary,Octal,LowerHex,UpperHex,LowerExp,UpperExp
- The
Powimplementations have been expanded.Pow<BigInt>andPow<BigUint>are now implemented.Pow<_> for &Ratio<T>now uses&T: Pow.- The inherent
powmethod now uses&T: Pow.
Breaking Changes
num-rationalnow requires Rust 1.31 or greater.- The "i128" opt-in feature was removed, now always available.
- The "num-bigint-std" feature replaces "bigint" with
stdenabled.- The "num-bigint" feature without
stdusesallocon Rust 1.36+.
- The "num-bigint" feature without
Contributors: @cuviper, @MattX, @maxbla
-
0.2.417 Mar 2020 -
0.2.310 Jan 2020Release notes
Open source →Rationow performs earlier reductions to avoid overflow with+-*/%operators.Ratio::{new_raw, numer, denom}are nowconst fnfor Rust 1.31 and later.- Updated the
autocfgbuild dependency to 1.0.
Contributors: @cuviper, @dingelish, @jimbo1qaz, @maxbla
-
0.2.211 Jun 2019 -
0.2.123 Jun 2018 -
0.2.020 Jun 2018Release notes
Open source →Enhancements
Rationow implementsOne::is_oneand theInvtrait.Rationow implementsSumandProduct.Rationow supportsi128andu128components with Rust 1.26+.Rationow implements thePowtrait.
Breaking Changes
num-rationalnow requires rustc 1.15 or greater.- There is now a
stdfeature, enabled by default, along with the implication that building without this feature makes this a#![no_std]crate. A few methods now requireFloatCoreinstead ofFloat. - The
serdedependency has been updated to 1.0, andrustc-serializeis no longer supported bynum-rational. - The optional
num-bigintdependency has been updated to 0.2, and should be enabled using thebigint-stdfeature. In the future, it may be possible to use thebigintfeature withno_std.
Contributors: @clarcharr, @cuviper, @Emerentius, @robomancer-or, @vks
-
0.1.4325 Jan 2025Nothing published for this version
-
0.1.4209 Feb 2018 -
0.1.4127 Jan 2018Release notes
Open source →- num-rational now has its own source repository at rust-num/num-rational.
Rationow implementsCheckedAdd,CheckedSub,CheckedMul, andCheckedDiv.Rationow implementsAddAssign,SubAssign,MulAssign,DivAssign, andRemAssignwith eitherRatioor an integer on the right side. The non-assignment operators now also accept integers as an operand.Ratiooperators now make fewerclone()calls.
Thanks to @c410-f3r, @cuviper, and @psimonyi for their contributions!
-
0.1.4008 Nov 2017Nothing published for this version
-
0.1.3915 Jul 2017Nothing published for this version
-
0.1.3809 Jun 2017Nothing published for this version
-
0.1.3709 Jun 2017 withdrawnNothing published for this version
-
0.1.3626 Feb 2017Nothing published for this version
-
0.1.3518 Aug 2016Nothing published for this version
-
0.1.3214 Apr 2016Nothing published for this version