num-rational
num-rational copied to clipboard
Generic Rational numbers for Rust
Currently, the arithmetic operations do a lot of `clone`s. However, this is quite inefficient when using types with non-trivial `Clone` impls, such as `BigInt` in `BigRational`. We could instead do...
Hey there. Cool crate! Any reason `approximate_float_unsigned` isn't exposed in the lib interface ? It makes it impossible to approximate into unsigned ratios. Here's a small patch that fixes that....
A request to create a function (for now I'll call it `Ratio::into_raw`) which acts like this: ```rust fn into_raw(self) -> (T, T) { (self.numer, self.denom) } ``` This would be...
Earlier versions won't see the incompatible updates at all!
## Motivation I'm working on a generative music project downstream (picture a DAW-like interface) that uses `Ratio` to represent time. One very common operation in this project is checking if...
Would a PR be welcome where most of the methods and [trait-impls](https://crates.io/crates/const-ops) are constified which could either be hidden behind a feature gate, similar to how it is achieved in...
I didn't include this in #119 as I wasn't sure if it would require a version bump and therefore be more controversial.
I use this crate to convert an `f64` into an fps value (video framerate) consisting of `u32` numerator and denominator. The documentation for [`Ratio::::from_f64()`](https://docs.rs/num-rational/latest/num_rational/struct.Ratio.html#method.from_f64-9), for [`Ratio`](https://docs.rs/num-rational/latest/num_rational/struct.Ratio.html) and for [`num_traits::cast::FromPrimitive`](https://docs.rs/num-traits/0.2.15/num_traits/cast/trait.FromPrimitive.html) is...
- `Ratio` now specifies exact cases when converting to it yields `None`. --- See https://github.com/rust-num/num-rational/issues/113.