Why aren't some common numeric functions combined into number traits?

For instance i8, i16, i32, i64, i128 all have the same functions in their impls. It seems the obvious thing to do would be to make all these functions a part of some SignedInt trait which the primitive types would then implement. Any reason why this wasn't done?

I believe the short answer is we did that, weren't sure we got it right, then crate-ified it instead. So for now everyone uses https://crates.io/crates/num-traits for this.

Weirdly, I can't actually find the part where we decided to completely remove these from std, but this is what I can find:

1 Like

See also the very recent (perhaps even still ongoing) discussion at:

What numeric traits make sense for std?

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.