Python 3.x rounding behavior

前端 未结 11 1829
别那么骄傲
别那么骄傲 2020-11-22 00:41

I was just re-reading What’s New In Python 3.0 and it states:

The round() function rounding strategy and return type have changed. Exact halfway cas

11条回答
  •  执笔经年
    2020-11-22 00:53

    Python 2 rounding behaviour in python 3.

    Adding 1 at the 15th decimal places. Accuracy upto 15 digits.

    round2=lambda x,y=None: round(x+1e-15,y)
    

提交回复
热议问题