umedoblock added the comment:

last compared results are different.
should be bug or at least think that how to get a same result
about "D(round(df2, 2)) == D(round(ds2, 2))"

>>> from decimal import Decimal as D
>>> f1 = 1.65
>>> s1 = str(f1)
>>> df1 = D(f1)
>>> ds1 = D(s1)
>>> f2 = 2.675
>>> s2 = str(f2)
>>> df2 = D(f2)
>>> ds2 = D(s2)

>>> f1, df1, ds1
(1.65, Decimal('1.649999999999999911182158029987476766109466552734375'), 
Decimal('1.65'))
>>> f2, df2, ds2
(2.675, Decimal('2.67499999999999982236431605997495353221893310546875'), 
Decimal('2.675'))

>>> D(round(df1, 1)) == D(round(ds1, 1))
True
>>> D(round(df2, 2)) == D(round(ds2, 2))
False

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24827>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to