Python Function Reference

math.pow

Raise a number to a power after converting both arguments to float.

Python 3.13
math.pow(x, y)
x
The base.
int | float
y
The exponent.
int | float

Return value

Always a float, even for integer arguments.

Examples

Power as a float

Python 3.13
import math
print(math.pow(2, 3))
8.0

Comparison with the ** operator

Python 3.13
import math
print(math.pow(2, 3), 2 ** 3)
8.0 8

Details

For an exact integer result, use the ** operator or the built-in pow. Raises ValueError for a negative x and a fractional y.

See also