I want to raise x to the power of y in ptx.
Nvidia has a function ex2 which calculates 2^x and lg2 which calculates log2x but there's no function for calculating x^y.
Is there more clever and simpler solution that multiplying value in loop? How code from .cu file is converted to .ptx when it has pow(x, y)
?
Maybe there's clever solution with using ex2 and lg2 to calculate x^y?
Solution:
As @talonmies mentioned:
if z = x^y
, then log2(z) = y * log2(x)
so x^y = 2^(y*log2(x))