[issue24827] round(1.65, 1) return 1.6 with decimal

2017-07-30 Thread Huan Wang
Huan Wang added the comment: Hi Mark, Thank you for your reply. I went over again the answer from Zachary Ware published on 2015-08-08 09:36. I got the point that it is better to use string type of number. >>> from decimal import Decimal, ROUND_HALF_UP >>> Decimal(&qu

[issue24827] round(1.65, 1) return 1.6 with decimal

2017-07-30 Thread Huan Wang
Huan Wang added the comment: Hello, I was confused by the decimal module. The problem is that I want to from decimal import Decimal, ROUND_HALF_UP def rounded(number, n): ''' Round the digits after the n_th decimal point by using decimal module in python.