Lines Matching refs:modulo
975 # have the same sign, and (ii) n is congruent to m modulo
1853 def _power_modulo(self, other, modulo, context=None):
1856 # if can't convert other and modulo to Decimal, raise
1860 modulo = _convert_other(modulo
1869 modulo_is_nan = modulo._isnan()
1879 modulo)
1884 return modulo._fix_nan(context)
1889 modulo._isinteger()):
1897 if not modulo:
1903 if modulo.adjusted() >= context.prec:
1923 # convert modulo to a Python integer, and self and other to
1925 modulo = abs(int(modulo))
1930 base = (base.int % modulo * pow(10, base.exp, modulo)) % modulo
1932 base = pow(base, 10, modulo)
1933 base = pow(base, exponent.int, modulo)
2174 def __pow__(self, other, modulo=None, context=None):
2175 """Return self ** other [ % modulo].
2179 With three arguments, compute (self**other) % modulo. For the
2186 - modulo must be nonzero and must have at most p digits,
2192 The result of pow(self, other, modulo) is identical to the
2194 modulo with unbounded precision, but is computed more
2198 if modulo is not None:
2199 return self._power_modulo(other, modulo, context)
4965 def power(self, a, b, modulo=None):
4966 """Raises a to the power of b, to modulo if given.
4973 With three arguments, compute (a**b) % modulo. For the
4980 - modulo must be nonzero and have at most 'precision' digits
4982 The result of pow(a, b, modulo) is identical to the result
4983 that would be obtained by computing (a**b) % modulo with
5039 r = a.__pow__(b, modulo, context=self)