public double myPow(double x, int n) {

```
if(n < 0){
n = -n;
x = 1 / x;
}
if(n == 0) return 1;
double ret = x;
int tmp = 1;
while(2 * tmp <= n){
tmp += tmp;
ret *= ret;
}
return ret * myPow(x, n - tmp);
}
```

Failed at x = 0.00001, k = 2147483647

Anyone knows why? Thanks!