pow
pow(x, y[, z])
Returns x to the power y; if z is present, returns x to the power y,
modulo z (computed more efficiently than pow(x, y) % z). The
arguments must have numeric types. With mixed operand types, the
coercion rules for binary arithmetic operators apply. For int and long
int operands, the result has the same type as the operands (after
coercion) unless the second argument is negative; in that case, all
arguments are converted to float and a float result is delivered. For
example, 10\*\*2 returns 100, but 10\*\*-2 returns 0.01. (This
last feature was added in Python 2.2. In Python 2.1 and before, if
both arguments were of integer types and the second argument was
negative, an exception was raised.) If the second argument is
negative, the third argument must be omitted. If z is present, x and y
must be of integer types, and y must be non-negative. (This
restriction was added in Python 2.2. In Python 2.1 and before,
floating 3-argument pow() returned platform-dependent results
depending on floating-point rounding accidents.)
last updated 2 years ago by effbot #
