pow function

Returns x to the power of exponent.

num pow(
num x,
num exponent
)

Returns x to the power of exponent.

If x is an int and exponent is a non-negative int, the result is an int, otherwise both arguments are converted to doubles first, and the result is a double.

For integers, the power is always equal to the mathematical result of x to the power exponent, only limited by the available memory.

For doubles, pow(x, y) handles edge cases as follows:

This corresponds to the pow function defined in the IEEE Standard 754-2008.

Notice that an int result cannot overflow, but a double result might be double.INFINITY.