Lines Matching full:prec
61 >>> getcontext().prec = 18
351 return _dec_from_triple(sign, '9'*context.prec,
352 context.Emax-context.prec+1)
356 return _dec_from_triple(sign, '9'*context.prec,
357 context.Emax-context.prec+1)
472 ctx.prec += 2
485 >>> print getcontext().prec
489 ... ctx.prec += 2
490 ... print ctx.prec
494 ... print getcontext().prec
497 >>> print getcontext().prec
1165 exp = max(exp, other._exp - context.prec-1)
1170 exp = max(exp, self._exp - context.prec-1)
1177 op1, op2 = _normalize(op1, op2, context.prec)
1330 shift = len(other._int) - len(self._int) + context.prec + 1
1353 """Return (self // other, self % other), to context.prec precision.
1368 if expdiff <= context.prec:
1376 if q < 10**context.prec:
1512 if expdiff >= context.prec + 1:
1513 # expdiff >= prec+1 => abs(self/other) > 10**prec
1535 if q >= 10**context.prec:
1634 max_payload_len = context.prec - context._clamp
1641 """Round if it is necessary to keep self within prec precision.
1672 # equal to max(self.adjusted()-context.prec+1, Etiny)
1673 exp_min = len(self._int) + self._exp - context.prec
1696 if len(coeff) > context.prec:
1734 # prec is an integer satisfying 0 <= prec < len(self._int)
1742 def _round_down(self, prec):
1744 if _all_zeros(self._int, prec):
1749 def _round_up(self, prec):
1751 return -self._round_down(prec)
1753 def _round_half_up(self, prec):
1755 if self._int[prec] in '56789':
1757 elif _all_zeros(self._int, prec):
1762 def _round_half_down(self, prec):
1764 if _exact_half(self._int, prec):
1767 return self._round_half_up(prec)
1769 def _round_half_even(self, prec):
1771 if _exact_half(self._int, prec) and \
1772 (prec == 0 or self._int[prec-1] in '02468'):
1775 return self._round_half_up(prec)
1777 def _round_ceiling(self, prec):
1780 return self._round_down(prec)
1782 return -self._round_down(prec)
1784 def _round_floor(self, prec):
1787 return self._round_down(prec)
1789 return -self._round_down(prec)
1791 def _round_05up(self, prec):
1792 """Round down unless digit prec-1 is 0 or 5."""
1793 if prec and self._int[prec-1] not in '05':
1794 return self._round_down(prec)
1796 return -self._round_down(prec)
1902 # than 10**prec in absolute value
1903 if modulo.adjusted() >= context.prec:
2255 # 1-context.prec) but evaluating int(other) directly
2260 elif other > context.prec:
2261 multiplier = context.prec
2266 if exp < 1-context.prec:
2267 exp = 1-context.prec
2272 exp = 1-context.prec
2312 ans = self._power_exact(other, context.prec + 1)
2320 p = context.prec
2353 # pad with zeros up to length context.prec+1 if necessary; this
2355 if len(ans._int) <= context.prec:
2356 expdiff = context.prec + 1 - len(ans._int)
2468 if self_adjusted - exp._exp + 1 > context.prec:
2476 if len(ans._int) > context.prec:
2654 prec = context.prec+1
2669 # rescale so that c has exactly prec base 100 'digits'
2670 shift = prec-l
2680 n = 10**prec
2959 p = context.prec
3119 p = context.prec
3200 p = context.prec
3264 dif = context.prec - len(opa)
3268 opa = opa[-context.prec:]
3269 dif = context.prec - len(opb)
3273 opb = opb[-context.prec:]
3286 # fill to context.prec
3297 return self.logical_xor(_dec_from_triple(0,'1'*context.prec,0),
3310 # fill to context.prec
3327 # fill to context.prec
3406 return _dec_from_triple(0, '9'*context.prec, context.Etop())
3429 return _dec_from_triple(1, '9'*context.prec, context.Etop())
3545 if not (-context.prec <= int(other) <= context.prec):
3554 topad = context.prec - len(rotdig)
3578 liminf = -2 * (context.Emax + context.prec)
3579 limsup = 2 * (context.Emax + context.prec)
3603 if not (-context.prec <= int(other) <= context.prec):
3612 topad = context.prec - len(rotdig)
3623 shifted = shifted[-context.prec:]
3767 prec - precision (for use in rounding, division, square roots..)
3782 def __init__(self, prec=None, rounding=None,
3794 self.prec = prec if prec is not None else dc.prec
3823 s.append('Context(prec=%(prec)d, rounding=%(rounding)s, '
3839 nc = Context(self.prec, self.rounding, self.traps,
3846 nc = Context(self.prec, self.rounding, self.traps.copy(),
3896 """Returns Etiny (= Emin - prec + 1)"""
3897 return int(self.Emin - self.prec + 1)
3900 """Returns maximum exponent (= Emax - prec + 1)"""
3901 return int(self.Emax - self.prec + 1)
3934 if d._isnan() and len(d._int) > self.prec - self._clamp:
3943 >>> context = Context(prec=5, rounding=ROUND_DOWN)
3946 >>> context = Context(prec=5, traps=[Inexact])
5311 >>> ExtendedContext.prec
5446 def _normalize(op1, op2, prec = 0):
5465 exp = tmp.exp + min(-1, tmp_len - prec - 2)
5860 prec=28, rounding=ROUND_HALF_EVEN,
5874 prec=9, rounding=ROUND_HALF_UP,
5880 prec=9, rounding=ROUND_HALF_EVEN,