Home | History | Annotate | Download | only in python2.7

Lines Matching defs:power

240     power operation with negative right-hand operand), and the dividend was
244 or of the signs of the operands for divide, or is 1 for an odd power of
245 -0, for power.
1274 # Special case for multiplying by power of 10
1941 compute an exact result for the power self**other, with p
1963 # representable (at *any* precision), xc must be the nth power of a
1965 # then additionally xc must be a power of either 2 or 5, hence a power
2028 # case where y is negative: xc must be either a power
2029 # of 2 or a power of 5.
2033 # quick test for power of 2
2036 # now xc is a power of 2; e is its exponent
2079 # e >= log_5(xc) if xc is a power of 5; we have
2090 # the 'xc is a power of 2' branch. 10/3 is an upper bound for
2131 # if 1 < xc < 2**n then xc isn't an nth power
2152 # compute mth power of xc*10**xe
2339 # unlike exp, ln and log10, the power function respects the
4965 def power(self, a, b, modulo=None):
4966 """Raises a to the power of b, to modulo if given.
4990 >>> c.power(Decimal('2'), Decimal('3'))
4992 >>> c.power(Decimal('-2'), Decimal('3'))
4994 >>> c.power(Decimal('2'), Decimal('-3'))
4996 >>> c.power(Decimal('1.7'), Decimal('8'))
4998 >>> c.power(Decimal('10'), Decimal('0.301029996'))
5000 >>> c.power(Decimal('Infinity'), Decimal('-1'))
5002 >>> c.power(Decimal('Infinity'), Decimal('0'))
5004 >>> c.power(Decimal('Infinity'), Decimal('1'))
5006 >>> c.power(Decimal('-Infinity'), Decimal('-1'))
5008 >>> c.power(Decimal('-Infinity'), Decimal('0'))
5010 >>> c.power(Decimal('-Infinity'), Decimal('1'))
5012 >>> c.power(Decimal('-Infinity'), Decimal('2'))
5014 >>> c.power(Decimal('0'), Decimal('0'))
5017 >>> c.power(Decimal('3'), Decimal('7'), Decimal('16'))
5019 >>> c.power(Decimal('-3'), Decimal('7'), Decimal('16'))
5021 >>> c.power(Decimal('-3'), Decimal('8'), Decimal('16'))
5023 >>> c.power(Decimal('3'), Decimal('7'), Decimal('-16'))
5025 >>> c.power(Decimal('23E12345'), Decimal('67E189'), Decimal('123456789'))
5027 >>> c.power(Decimal('-0'), Decimal('17'), Decimal('1729'))
5029 >>> c.power(Decimal('-23'), Decimal('0'), Decimal('65537'))
5031 >>> ExtendedContext.power(7, 7)
5033 >>> ExtendedContext.power(Decimal(7), 7)
5035 >>> ExtendedContext.power(7, Decimal(7), 2)
5050 exponent is being increased), multiplied by a positive power of ten (if
5510 # val_n = largest power of 10 dividing n.
5716 # by a suitable power R of 2 so that |z/2**R| < 2**-L. Then