The results of pow are often irrational, fractional or too large to store as a long
, If you want to use powers of integers you can use
BigInteger bi = BigInteger.valueOf(100);
BigInteger bi2 = bi.pow(20); // 10^40
Another reason maybe that Math has many function which are taken from C, and also from common CPU instructions sets. C only has a floating point method and x64 only has the floating point version of pow.
1
solved why java Math.pow arguments double?