rust-num / num-traits

Numeric traits for generic mathematics in Rust
Apache License 2.0
732 stars 135 forks source link

Easy conversions between `Signed` and `Unsigned` #46

Closed clarfonthey closed 6 years ago

clarfonthey commented 6 years ago

It would be nice if Signed and Unsigned had a way to convert between each other, presumably via:

This would be a breaking change but a useful one. For example, a Pow implementation for Ratio could leverage these methods so that the signed and unsigned versions relied on each others' implementations, instead of duplicating code.

cuviper commented 6 years ago

I've decided to limit the clutter of breaking change issues, so they will now be tracked collectively in #47. I'm closing this issue for now as postponed but we can still discuss its merits here as needed.