def _round_quantize(self, val):
# round() has different behavior in python 2/3
# For consistency between 2 and 3 we use quantize, however
# it is slower than the built in round function.
d = decimal.Decimal(val)
rounded = d.quantize(1, rounding=decimal.ROUND_HALF_EVEN)
return float(rounded)
评论列表
文章目录