diff options
author | Raymond Hettinger <python@rcn.com> | 2004-07-14 19:56:56 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-07-14 19:56:56 (GMT) |
commit | 99148e7eaad7741fbfb0822009b7c9b216ecc227 (patch) | |
tree | 7fd975001819a34bb0dfb44646017f76a14fb591 | |
parent | d15dc06df062fdf0fe8badec2982c6c5e0e28eb0 (diff) | |
download | cpython-99148e7eaad7741fbfb0822009b7c9b216ecc227.zip cpython-99148e7eaad7741fbfb0822009b7c9b216ecc227.tar.gz cpython-99148e7eaad7741fbfb0822009b7c9b216ecc227.tar.bz2 |
Factor out two unnecessary global variables.
-rw-r--r-- | Lib/decimal.py | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py index 9cc9c0f..ba94d7a 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -129,10 +129,6 @@ import threading import copy import operator -#Exponent Range -DEFAULT_MAX_EXPONENT = 999999999 -DEFAULT_MIN_EXPONENT = -999999999 - #Rounding ROUND_DOWN = 'ROUND_DOWN' ROUND_HALF_UP = 'ROUND_HALF_UP' @@ -1699,7 +1695,7 @@ class Decimal(object): elength = len(str(abs(n))) firstprec = context.prec - if not modulo and firstprec + elength + 1 > DEFAULT_MAX_EXPONENT: + if not modulo and firstprec + elength + 1 > DefaultContext.Emax: return context._raise_error(Overflow, 'Too much precision.', sign) mul = Decimal(self) @@ -1922,8 +1918,7 @@ class Decimal(object): #ans is now a linear approximation. Emax, Emin = context.Emax, context.Emin - context.Emax, context.Emin = DEFAULT_MAX_EXPONENT, DEFAULT_MIN_EXPONENT - + context.Emax, context.Emin = DefaultContext.Emax, DefaultContext.Emin half = Decimal('0.5') @@ -2947,8 +2942,8 @@ DefaultContext = Context( traps=[DivisionByZero, Overflow, InvalidOperation], flags=[], _rounding_decision=ALWAYS_ROUND, - Emax=DEFAULT_MAX_EXPONENT, - Emin=DEFAULT_MIN_EXPONENT, + Emax=999999999, + Emin=-999999999, capitals=1 ) @@ -2961,14 +2956,12 @@ BasicContext = Context( prec=9, rounding=ROUND_HALF_UP, traps=[DivisionByZero, Overflow, InvalidOperation, Clamped, Underflow], flags=[], - _rounding_decision=ALWAYS_ROUND, ) ExtendedContext = Context( prec=9, rounding=ROUND_HALF_EVEN, traps=[], flags=[], - _rounding_decision=ALWAYS_ROUND, ) |