double Pow(double x, unsigned n)
{
if (n == 0) return 1.0;
if (n == 1) return x;
double ans = 1;
while (n > 0)
{
if (n & 1) ans *= x;
x *= x;
n /= 2;
}
return ans;
}
bool equal(double x, double y)
{
if (x - y > -0.0000001 && x - y < 0.0000001) return true;
else return false;
}
double myPow(double x, int n) {
if (equal(x, 0.0)) return 0.0;
unsigned int nn;
if (n < 0)
{
if (n == INT_MIN) nn = (unsigned)INT_MAX + 1;
else nn = -n;
}
double res = Pow(x, nn);
return n < 0? 1.0/res: res;
}