def _round(self, val):
# Prefer provided round function.
if self.round_fn:
return self.round_fn(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)
encoder.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录