Lines Matching refs:power
271 power operation with negative right-hand operand), and the dividend was
275 or of the signs of the operands for divide, or is 1 for an odd power of
276 -0, for power.
1315 # Special case for multiplying by power of 10
2065 compute an exact result for the power self**other, with p
2087 # representable (at *any* precision), xc must be the nth power of a
2089 # then additionally xc must be a power of either 2 or 5, hence a power
2152 # case where y is negative: xc must be either a power
2153 # of 2 or a power of 5.
2157 # quick test for power of 2
2160 # now xc is a power of 2; e is its exponent
2203 # e >= log_5(xc) if xc is a power of 5; we have
2214 # the 'xc is a power of 2' branch. 10/3 is an upper bound for
2255 # if 1 < xc < 2**n then xc isn't an nth power
2276 # compute mth power of xc*10**xe
2463 # unlike exp, ln and log10, the power function respects the
5155 def power(self, a, b, modulo=None):
5156 """Raises a to the power of b, to modulo if given.
5180 >>> c.power(Decimal('2'), Decimal('3'))
5182 >>> c.power(Decimal('-2'), Decimal('3'))
5184 >>> c.power(Decimal('2'), Decimal('-3'))
5186 >>> c.power(Decimal('1.7'), Decimal('8'))
5188 >>> c.power(Decimal('10'), Decimal('0.301029996'))
5190 >>> c.power(Decimal('Infinity'), Decimal('-1'))
5192 >>> c.power(Decimal('Infinity'), Decimal('0'))
5194 >>> c.power(Decimal('Infinity'), Decimal('1'))
5196 >>> c.power(Decimal('-Infinity'), Decimal('-1'))
5198 >>> c.power(Decimal('-Infinity'), Decimal('0'))
5200 >>> c.power(Decimal('-Infinity'), Decimal('1'))
5202 >>> c.power(Decimal('-Infinity'), Decimal('2'))
5204 >>> c.power(Decimal('0'), Decimal('0'))
5207 >>> c.power(Decimal('3'), Decimal('7'), Decimal('16'))
5209 >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16'))
5211 >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16'))
5213 >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16'))
5215 >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789'))
5217 >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729'))
5219 >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537'))
5221 >>> ExtendedContext.power(7, 7)
5223 >>> ExtendedContext.power(Decimal(7), 7)
5225 >>> ExtendedContext.power(7, Decimal(7), 2)
5240 exponent is being increased), multiplied by a positive power of ten (if
5702 # val_n = largest power of 10 dividing n.
5908 # by a suitable power R of 2 so that |z/2**R| < 2**-L. Then