rust-num / num-traits

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

Float: FloatCore + Real #339

Open tyilo opened 1 month ago

tyilo commented 1 month ago

Is there a reason that Float doesn't have FloatCore and Real as super traits?

cuviper commented 1 month ago

That's mainly an artifact of history, since Float came first, and it's a breaking change to add a super trait.

I think it would also cause method resolution ambiguity in the current state, since any T: Float context would have multiple overlapping method names in scope. If we ever do make that breaking change, Float should only add distinct methods over its super traits.

tyilo commented 1 month ago

If we ever do make that breaking change, Float should only add distinct methods over its super traits.

That was also my idea.