rust-num / num-traits

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

move to `Required Associated Constants` #311

Closed BabaBert closed 8 months ago

BabaBert commented 8 months ago

This merge request transitions the trait methods of associated constants to actual required constants. It also adds MANTISSA_DIGITS, DIGITS and RADIX to the Float traits. This would close https://github.com/rust-num/num-traits/issues/213

cuviper commented 8 months ago

I'm not planning to process breaking changes anytime soon, so I'd rather leave this on the issue for now. A pull request will only bitrot over time. Thanks anyway!

BabaBert commented 8 months ago

I fully understand that. However, is it an option to add these associated on top of the current methods? That would be possible and not break any existing functionality.

tarcieri commented 8 months ago

@BabaBert see #303 as an additive PR for traits with associated constants which was accepted

BabaBert commented 8 months ago

@tarcieri so I should rather create (a) new trait(s) that only contain the associates and implement that instead. That's a good point, but then the question arises how that trait should be called (FloatConst is already used) and how they should be split up. I would suggest having all the constants in one place, as they are related.