HOT!!!!# PDA - 掌中宝
w*x
1 楼
double pow(double x, int n) {
if (n < 0)
return 1/pow(x, -n);
if (n == 0)
return 1;
double mul = n%2 == 1 ? x : 1;
double db = pow(x, n/2);
return db*db*mul;
}
why??????
if (n < 0)
return 1/pow(x, -n);
if (n == 0)
return 1;
double mul = n%2 == 1 ? x : 1;
double db = pow(x, n/2);
return db*db*mul;
}
why??????