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.
1 parent a3e303f commit ae49264Copy full SHA for ae49264
src/future/builtins/newround.py
@@ -38,11 +38,12 @@ 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)
44
- else:
45
- d = from_float_26(number).quantize(exponent, rounding=ROUND_HALF_EVEN)
+ if not isinstance(d, Decimal):
+ if not PY26:
+ d = Decimal.from_float(number).quantize(exponent,
+ rounding=ROUND_HALF_EVEN)
+ else:
46
+ d = from_float_26(number).quantize(exponent, rounding=ROUND_HALF_EVEN)
47
48
if return_int:
49
return int(d)
0 commit comments