I have a case where I need to calculate x^y a vast number of times where y is a constant and x is guaranteed to be a valid number.
How can this be done more efficiently that Pow(double x, double y), which will perform various checks and evaluations?
I am looking to precalculate the y transformation.
EDIT
Both are real numbers. x = 0 ... 4,000,000,000.
Remember this equiality:
x^y = exp(y * ln(x))
So you can skip Pow
and use exp
and ln
.