-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Idea: Pow trait #38
Comments
It makes sense to me, especially since types can make internal decisions about stuff like #18. |
(We can de-emphasize the generic |
It might also be interesting that floats can implement both |
Looks good :) I think it is very useful since it can be implemented for |
I've been working on a crate which works with runtime-level units, and I think that having a generic
Pow
trait would be useful.Essentially, it would be very similar to the other unary op traits, namely:
And in most cases, this would simply do exponentiation by squaring as included in the existing
pow
functions. However, it may be easier to implement for some types, namely a unit could simply multiply a field that indicates what power of the given unit you have. Another example is that a type which constrains which values it has, e.g. a matrix which specifically performs scaling operations, could be modified to do less work.This would be weird to implement and may cause confusion with the existing
pow
function, which is why I haven't offered a PR for it. But it might be nice to have in this crate.The text was updated successfully, but these errors were encountered: