rust-num / num-rational

Generic Rational numbers for Rust
Apache License 2.0
144 stars 51 forks source link

Exposes approximate_float for unsigned ratios #109

Closed nullsauce closed 1 year ago

nullsauce commented 2 years ago

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. Hope it helps!

cuviper commented 1 year ago

For primitive floats you can use FromPrimitive::from_f32 or from_f64, but for generic FloatCore we do need something else. I guess this was just an oversight, and nobody had asked for it yet. Thanks!

bors r+

bors[bot] commented 1 year ago

Build failed:

cuviper commented 1 year ago

bors r+

bors[bot] commented 1 year ago

Build succeeded: