Such implicit argument conversion will cause huge ...
# stdlib
v
Such implicit argument conversion will cause huge performance issues. When I write
5.pow(4)
I expect it to perform the most efficient way, using the information that both arguments are integers
g
As I said, it's not my suggestion to add to stdlib, I just showed example how this can be done on your own project if you really need it for some reason, I'm fine with current doubles API. All those conversions anyway cannot be done efficiently without some intrinsic that I'm not even sure would be possible to do more efficiently than doubles pow on CPU
k
I usually paste something like this in my projects.
g
Hmm, not sure about recursive algorithm for that
k
Without the recursion of course.
v
Maybe it makes sense to put that algorithm into stdlib. @karelpeeters Could you share your use cases when it makes sense to use integer power and numbers are small enough to be int or long?