num-traits
num-traits copied to clipboard
Deprecate PrimInt and Float pow functions
Instead of using PrimInt::pow
, Float::powi
, or Float::powf
, the Pow
trait should be used instead.
I don't know if they deserve deprecation -- the Pow
trait is more general, but also more cumbersome as a result. It's another trait to import, with the exponent and Output
types to consider when using it.
Note that the primitive floats also have powi
and powf
, so it makes sense that Float
has them as well, since it is supposed to abstract over them. It is nice if f32
and f64
can be replaced with T: Float
with minimal changes to the code.
For integers, PrimInt::pow
could be replaced with an additional Pow<u32, Output = Self>
constraint, but this is a breaking change.