[issue39124] round Decimal error

2019-12-23 Thread Mark Dickinson
Mark Dickinson added the comment: @adelsonllima: Take a look at the documentation that I linked to for the round function, and in particular this note: "The behavior of round() for floats can be surprising: for example, round(2.675, 2) gives 2.67 instead of the expected 2.68. This is not a bu

[issue39124] round Decimal error

2019-12-23 Thread Mark Dickinson
Change by Mark Dickinson : -- status: open -> closed type: crash -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue39124] round Decimal error

2019-12-23 Thread Jörn Heissler
Jörn Heissler added the comment: > round(9.925, 2) => 9.93 9.925 is 9.925710542735760100185871124267578125 on my platform. This is larger than 9.925, so the "round-ties-to-even" rule can't be applied. Instead it is rounded up to 9.93 (9.92971578290569595992565155029296

[issue39124] round Decimal error

2019-12-23 Thread Adelson Luiz de Lima
Adelson Luiz de Lima added the comment: Thanks for the quick response. I try the follow code in python 3.7: round(9.925, 2) => 9.93 round(Decimal('9.925'), 2) => Decimal('9.92') I do not understande why behavior of float is diferrent of the Decimal. In python 2.7 I have the same result: 9.9

[issue39124] round Decimal error

2019-12-23 Thread Mark Dickinson
Mark Dickinson added the comment: More details on the change here: https://docs.python.org/3/whatsnew/3.0.html#builtins and in the library documentation: https://docs.python.org/3/library/functions.html#round -- ___ Python tracker

[issue39124] round Decimal error

2019-12-23 Thread Mark Dickinson
Mark Dickinson added the comment: In Python 3, the rounding mode is round-ties-to-even. (In Python 2, it's round-ties-to-away.) -- nosy: +mark.dickinson resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue39124] round Decimal error

2019-12-23 Thread Adelson Luiz de Lima
New submission from Adelson Luiz de Lima : When I round this: round(Decimal('9.925'), 2), in Python 3.7.5 the result is Decimal('9.92'), but in Python 2.7.17 is 9.93 -- messages: 358814 nosy: adelsonllima priority: normal severity: normal status: open title: round Decimal error type: c