num-traits icon indicating copy to clipboard operation
num-traits copied to clipboard

Deprecate PrimInt and Float pow functions

Open clarfonthey opened this issue 6 years ago • 2 comments

Instead of using PrimInt::pow, Float::powi, or Float::powf, the Pow trait should be used instead.

clarfonthey avatar Mar 04 '18 22:03 clarfonthey

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.

cuviper avatar Mar 05 '18 19:03 cuviper

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.

vks avatar Apr 10 '18 14:04 vks