小编Kbo*_*bob的帖子

如何在Python中实现round-towards-infinity的划分

我希望3/2等于2而不是1.5

我知道这个操作有一个数学术语(不称为四舍五入),但我现在不记得了.无论如何,我怎么做而不必做两个功能?

我不想要的东西:

answer = 3/2 then math.ceil(answer)=2 (why does math.ceil(3/2)=1?)  
Run Code Online (Sandbox Code Playgroud)

我想做的事情:

 "function"(3/2) = 2
Run Code Online (Sandbox Code Playgroud)

python math floating-point rounding division

8
推荐指数
2
解决办法
5716
查看次数

标签 统计

division ×1

floating-point ×1

math ×1

python ×1

rounding ×1