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

Lines Matching refs:exp

558                 exp = int(m.group('exp') or '0')
560 self._exp = exp - len(fracpart)
601 self._exp = int(value.exp)
708 exp = self._exp
709 if exp == 'n':
711 elif exp == 'N':
978 return hash((-1)**op.sign*op.int*pow(10, op.exp, 2**64-1))
1043 exp = ''
1047 exp = ['e', 'E'][context.capitals] + "%+d" % (leftdigits-dotplace)
1049 return sign + intpart + fracpart + exp
1151 exp = min(self._exp, other._exp)
1161 ans = _dec_from_triple(sign, '0', exp)
1165 exp = max(exp, other._exp - context.prec-1)
1166 ans = other._rescale(exp, context.rounding)
1170 exp = max(exp, self._exp - context.prec-1)
1171 ans = self._rescale(exp, context.rounding)
1183 ans = _dec_from_triple(negativezero, '0', exp)
1207 result.exp = op1.exp
1326 exp = self._exp - other._exp
1331 exp = self._exp - other._exp - shift
1345 while exp < ideal_exp and coeff % 10 == 0:
1347 exp += 1
1349 ans = _dec_from_triple(sign, str(coeff), exp)
1371 if op1.exp >= op2.exp:
1372 op1.int *= 10**(op1.exp - op2.exp)
1374 op2.int *= 10**(op2.exp - op1.exp)
1523 if op1.exp >= op2.exp:
1524 op1.int *= 10**(op1.exp - op2.exp)
1526 op2.int *= 10**(op2.exp - op1.exp)
1930 base = (base.int % modulo * pow(10, base.exp, modulo)) % modulo
1931 for i in xrange(exponent.exp):
1996 xc, xe = x.int, x.exp
2002 yc, ye = y.int, y.exp
2254 # exp = max(self._exp*max(int(other), 0),
2265 exp = self._exp * multiplier
2266 if exp < 1-context.prec:
2267 exp = 1-context.prec
2272 exp = 1-context.prec
2274 return _dec_from_triple(result_sign, '1'+'0'*-exp, exp)
2318 # usual case: inexact result, x**y computed directly as exp(y*log(x))
2322 xc, xe = x.int, x.exp
2324 yc, ye = y.int, y.exp
2332 coeff, exp = _dpower(xc, xe, yc, ye, p+extra)
2337 ans = _dec_from_triple(result_sign, str(coeff), exp)
2339 # unlike exp, ln and log10, the power function respects the
2416 exp = dup._exp
2417 while dup._int[end-1] == '0' and exp < exp_max:
2418 exp += 1
2420 return _dec_from_triple(dup._sign, dup._int[:end], exp)
2422 def quantize(self, exp, rounding=None, context=None, watchexp=True):
2423 """Quantize self so its exponent is the same as that of exp.
2425 Similar to self._rescale(exp._exp) but with error checking.
2427 exp = _convert_other(exp, raiseit=True)
2434 if self._is_special or exp._is_special:
2435 ans = self._check_nans(exp, context)
2439 if exp._isinfinity() or self._isinfinity():
2440 if exp._isinfinity() and self._isinfinity():
2447 ans = self._rescale(exp._exp, rounding)
2455 # exp._exp should be between Etiny and Emax
2456 if not (context.Etiny() <= exp._exp <= context.Emax):
2461 ans = _dec_from_triple(self._sign, '0', exp._exp)
2468 if self_adjusted - exp._exp + 1 > context.prec:
2472 ans = self._rescale(exp._exp, rounding)
2508 def _rescale(self, exp, rounding):
2509 """Rescale self so that the exponent is exp, either by padding with zeros
2516 exp = exp to scale to (an integer)
2522 return _dec_from_triple(self._sign, '0', exp)
2524 if self._exp >= exp:
2527 self._int + '0'*(self._exp - exp), exp)
2530 # exp-1, replace self by 10**(exp-1) before rounding
2531 digits = len(self._int) + self._exp - exp
2533 self = _dec_from_triple(self._sign, '1', exp-1)
2540 return _dec_from_triple(self._sign, coeff, exp)
2661 e = op.exp >> 1
2662 if op.exp & 1:
2932 def exp(self, context=None):
2938 # exp(NaN) = NaN
2943 # exp(-Infinity) = 0
2947 # exp(0) = 1
2951 # exp(Infinity) = Infinity
2982 c, e = op.int, op.exp
2991 coeff, exp = _dexp(c, e, p+extra)
2996 ans = _dec_from_triple(0, str(coeff), exp)
3078 c, e = op.int, op.exp
3118 c, e = op.int, op.exp
3158 c, e = op.int, op.exp
3199 c, e = op.int, op.exp
3566 """Returns self operand after adding the second value to its exp."""
3718 exp = leftdigits-dotplace
3722 return _format_number(self._sign, intpart, fracpart, exp, spec)
4265 def exp(self, a):
4271 >>> c.exp(Decimal('-Infinity'))
4273 >>> c.exp(Decimal('-1'))
4275 >>> c.exp(Decimal('0'))
4277 >>> c.exp(Decimal('1'))
4279 >>> c.exp(Decimal('0.693147181'))
4281 >>> c.exp(Decimal('+Infinity'))
4283 >>> c.exp(10)
4287 return a.exp(context=self)
5237 """Returns the first operand after adding the second value its exp.
5419 __slots__ = ('sign','int','exp')
5422 # exp: None, int, or string
5428 self.exp = None
5432 self.exp = value._exp
5437 self.exp = value[2]
5440 return "(%r, %r, %r)" % (self.sign, self.int, self.exp)
5447 """Normalizes op1, op2 to have the same exp and length of coefficient.
5451 if op1.exp < op2.exp:
5458 # Let exp = min(tmp.exp - 1, tmp.adjusted() - precision - 1).
5459 # Then adding 10**exp to tmp has the same effect (after rounding)
5460 # as adding any positive quantity smaller than 10**exp; similarly
5461 # for subtraction. So if other is smaller than 10**exp we replace
5462 # it with 10**exp. This avoids tmp.exp - other.exp getting too large.
5465 exp = tmp.exp + min(-1, tmp_len - prec - 2)
5466 if other_len + other.exp - 1 < exp:
5468 other.exp = exp
5470 tmp.int *= 10 ** (tmp.exp - other.exp)
5471 tmp.exp = other.exp
5474 ##### Integer arithmetic functions used by ln, log10, exp and __pow__ #####
5675 Decimal.ln, Decimal.log10, Decimal.exp and Decimal.__pow__."""
5711 value, compute an integer approximation to M*exp(x/M). For 0 <=
5715 # Algorithm: to compute exp(z) for a real number z, first divide z
5717 # compute expm1(z/2**R) = exp(z/2**R) - 1 using the usual Taylor
5727 # expm1(z/2**(R-1)), ... , exp(z/2), exp(z).
5747 """Compute an approximation to exp(c*10**e), with p decimal places of
5753 (d-1)*10**f < exp(c*10**e) < (d+1)*10**f
5755 In other words, d*10**f is an approximation to exp(c*10**e) with p
5814 coeff, exp = 10**(p-1)+1, 1-p
5816 coeff, exp = 10**p-1, -p
5818 coeff, exp = _dexp(pc, -(p+1), p+1)
5820 exp += 1
5822 return coeff, exp
5908 (E(?P<exp>[-+]?\d+))? # followed by an optional exponent, or...
6143 def _format_number(is_negative, intpart, fracpart, exp, spec):
6149 exp: exponent, as an integer
6166 if exp != 0 or spec['type'] in 'eE':
6168 fracpart += "{0}{1:+}".format(echar, exp)