PyDocs

Nav

Numeric and Mathematical Modules

Context.power

decimal

method of Context
  • Context.power(x, y, modulo=None)
Compute a**b.

If 'a' is negative, then 'b' must be integral. The result will be
inexact unless 'a' is integral and the result is finite and can be
expressed exactly in 'precision' digits.  In the Python version the
result is always correctly rounded, in the C version the result is
almost always correctly rounded.

If modulo is given, compute (a**b) % modulo. The following
restrictions hold:

    * all three arguments must be integral
    * 'b' must be nonnegative
    * at least one of 'a' or 'b' must be nonzero
    * modulo must be nonzero and less than 10**prec in absolute
      value
Changed in 3.3
  • 3.3: The C module computes power() in terms of the correctly rounded exp() and ln() functions. The result is well-defined but only “almost always correctly rounded”.
0 Examples
No examples for decimal/Context.power.
See Also
No see-alsos for decimal/Context.power
0 Notes
No notes for Context.power