I have two sets of codes : (1) passed for all. (2) failed for corner case (1.00000, -2147483648). I understand for (2) -2147483648 taking off negative is 2147483648, exceeding INT_MAX. I don't understand why this case does not fail for (1).

```
(1)
double power (double x, int n) {
if (n == 0)
return 1;
double v = power(x, n / 2);
if (n % 2 == 0) {
return v * v;
} else {
return v * v * x;
}
}
double pow(double x, int n) {
if (n < 0) {
return 1 / power(x, -n);
} else {
return power(x, n);
}
}
(2)
double pow(double x, int n) {
if(x==0 && n==0) return (0);
if(n == 0&&x!=0) return 1;
if (n < 0)
return 1.0/pow(x, -n);
else
{
double v = pow(x, n/2);
if (n%2 == 0)
return v*v;
else
return v*v*x;
}
```