Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

round breaks on Decimal objects #556

Open
bwo opened this issue Apr 28, 2020 · 0 comments
Open

round breaks on Decimal objects #556

bwo opened this issue Apr 28, 2020 · 0 comments

Comments

@bwo
Copy link

bwo commented Apr 28, 2020

$ python
Python 2.7.15 (tags/v2.7.15:ca079a3ea3, Apr 18 2019, 17:07:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import Decimal
>>> round(Decimal(4))
4.0
>>> from builtins import round
>>> round(Decimal(4))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/source/.venv/lib/python2.7/site-packages/future/builtins/newround.py", line 42, in newround
    d = Decimal.from_float(number).quantize(exponent,
  File "/usr/local/lib/python2.7/decimal.py", line 690, in from_float
    n, d = abs(f).as_integer_ratio()
AttributeError: 'Decimal' object has no attribute 'as_integer_ratio'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant