快速幂
public class Solution {
public double Power(double base, int exponent) {
double res = 1;
if(exponent < 0) {
exponent *= -1;
base = 1 / base;
}
while(exponent != 0) {
int u = exponent & 1;
if(u == 1) {
res *= base;
}
base *= base;
exponent >>>= 1;
}
return res;
}
}