|
|
895f921 |
diff -up Python-2.7.1/Lib/decimal.py.fix-decimal-in-turkish-locale Python-2.7.1/Lib/decimal.py
|
|
|
895f921 |
--- Python-2.7.1/Lib/decimal.py.fix-decimal-in-turkish-locale 2010-07-08 17:22:54.000000000 -0400
|
|
|
895f921 |
+++ Python-2.7.1/Lib/decimal.py 2011-04-12 11:30:40.850350842 -0400
|
|
|
895f921 |
@@ -1720,8 +1720,6 @@ class Decimal(object):
|
|
|
895f921 |
# here self was representable to begin with; return unchanged
|
|
|
895f921 |
return Decimal(self)
|
|
|
895f921 |
|
|
|
895f921 |
- _pick_rounding_function = {}
|
|
|
895f921 |
-
|
|
|
895f921 |
# for each of the rounding functions below:
|
|
|
895f921 |
# self is a finite, nonzero Decimal
|
|
|
895f921 |
# prec is an integer satisfying 0 <= prec < len(self._int)
|
|
|
895f921 |
@@ -1788,6 +1786,17 @@ class Decimal(object):
|
|
|
895f921 |
else:
|
|
|
895f921 |
return -self._round_down(prec)
|
|
|
895f921 |
|
|
|
895f921 |
+ _pick_rounding_function = dict(
|
|
|
895f921 |
+ ROUND_DOWN = '_round_down',
|
|
|
895f921 |
+ ROUND_UP = '_round_up',
|
|
|
895f921 |
+ ROUND_HALF_UP = '_round_half_up',
|
|
|
895f921 |
+ ROUND_HALF_DOWN = '_round_half_down',
|
|
|
895f921 |
+ ROUND_HALF_EVEN = '_round_half_even',
|
|
|
895f921 |
+ ROUND_CEILING = '_round_ceiling',
|
|
|
895f921 |
+ ROUND_FLOOR = '_round_floor',
|
|
|
895f921 |
+ ROUND_05UP = '_round_05up',
|
|
|
895f921 |
+ )
|
|
|
895f921 |
+
|
|
|
895f921 |
def fma(self, other, third, context=None):
|
|
|
895f921 |
"""Fused multiply-add.
|
|
|
895f921 |
|
|
|
895f921 |
@@ -3705,18 +3714,6 @@ _numbers.Number.register(Decimal)
|
|
|
895f921 |
|
|
|
895f921 |
##### Context class #######################################################
|
|
|
895f921 |
|
|
|
895f921 |
-
|
|
|
895f921 |
-# get rounding method function:
|
|
|
895f921 |
-rounding_functions = [name for name in Decimal.__dict__.keys()
|
|
|
895f921 |
- if name.startswith('_round_')]
|
|
|
895f921 |
-for name in rounding_functions:
|
|
|
895f921 |
- # name is like _round_half_even, goes to the global ROUND_HALF_EVEN value.
|
|
|
895f921 |
- globalname = name[1:].upper()
|
|
|
895f921 |
- val = globals()[globalname]
|
|
|
895f921 |
- Decimal._pick_rounding_function[val] = name
|
|
|
895f921 |
-
|
|
|
895f921 |
-del name, val, globalname, rounding_functions
|
|
|
895f921 |
-
|
|
|
895f921 |
class _ContextManager(object):
|
|
|
895f921 |
"""Context manager class to support localcontext().
|
|
|
895f921 |
|
|
|
895f921 |
diff -up Python-2.7.1/Misc/NEWS.fix-decimal-in-turkish-locale Python-2.7.1/Misc/NEWS
|