We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d7f20ce + 53f4685 commit ac0b29aCopy full SHA for ac0b29a
src/future/builtins/newround.py
@@ -38,11 +38,14 @@ def newround(number, ndigits=None):
38
if 'numpy' in repr(type(number)):
39
number = float(number)
40
41
- if not PY26:
42
- d = Decimal.from_float(number).quantize(exponent,
43
- rounding=ROUND_HALF_EVEN)
+ if isinstance(d, Decimal):
+ d = number
44
else:
45
- d = from_float_26(number).quantize(exponent, rounding=ROUND_HALF_EVEN)
+ if not PY26:
+ d = Decimal.from_float(number).quantize(exponent,
46
+ rounding=ROUND_HALF_EVEN)
47
+ else:
48
+ d = from_float_26(number).quantize(exponent, rounding=ROUND_HALF_EVEN)
49
50
if return_int:
51
return int(d)
0 commit comments