python 精确计算与向上取整 decimal math.ceil

1.  精确计算

python的float型不精确,需要导入decimal包,以下是不精确举例:

导入decimal包后:

2.  向上取整

一般的取整数(向下取整):

向上取整的方法:

猜你喜欢

转载自www.cnblogs.com/cxhzy/p/9787071.html