How to create own power formula?

Hi,

How can I create my own power pow(base, exponent) formula?

Like: a(b,c)
Im not really sure what you are actually asking for, but if you are wondering how you use the power function in c++, read here - http://www.cplusplus.com/reference/cmath/pow/
I know how to use the power function. What I want to know is how can I create my own "custom" power function?
Instead of using pow (base, exponent), I want to use a(b,c) for power.
for example:
1
2
3
4
5
double pow(double x, double y)
{
	for (int i = 1; i < static_cast<int>(y); ++i, x *= x);
	return x += ((y - static_cast<int>(y)) * x);
}


Keep in mind that you are trying to reinvent the wheel which is not a wise idea.
Last edited on
Topic archived. No new replies allowed.