x raised to the power of n. If n is negative the result is 1 / pow(x, -n), which is calculated as integer division with remainder. This may result in a division by zero error.
If both x and n are 0, the result is 1.
If x is 0 and n is negative, the result is the same as the result of a division by zero.
assert(pow(2, 3) == 8); assert(pow(3, 2) == 9); assert(pow(2, 10) == 1_024); assert(pow(2, 20) == 1_048_576); assert(pow(2, 30) == 1_073_741_824); assert(pow(0, 0) == 1); assert(pow(1, -5) == 1); assert(pow(1, -6) == 1); assert(pow(-1, -5) == -1); assert(pow(-1, -6) == 1); assert(pow(-2, 5) == -32); assert(pow(-2, -5) == 0); assert(pow(cast(double) -2, -5) == -0.03125);
Compute the power of two integral numbers.