wasp256 - 4 months ago 7x

Java Question

I'm using the math library in combination with the JexlEngine to calculate different equations. In this equations I also have the

`pow`

`math.pow(99999, 10000)`

Answer

You can compare the exponent to

```
double base = 99999;
double maxExp = Math.log(Long.MAX_VALUE)/Math.log(base);
```

if the power is above maxExp, you will get an overflow.

Source (Stackoverflow)

Comments