pow function

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 the result may overflow. If integers are represented as 64-bit numbers, an integer result may be truncated, and a double result may overflow to positive or negative double.infinity.

Implementation

external num pow(num x, num exponent);