2024-09-28 22:28:47 发布
网友
我得到这个号码1.12412,我想round it to 1.12415或1.12410 (muliple of 5 in last decimal)
1.12412
round it to 1.12415
1.12410 (muliple of 5 in last decimal)
如果使用Round(X,4)函数,我得到1.1241 (4 decimals)
Round(X,4)
1.1241 (4 decimals)
有没有一种功能可以实现这一点? 谢谢
堆栈中有一个答案,但使用c#而不是python
你可以:
我的方法是首先指定舍入单位,然后使用如下简单技巧:
import numpy as np rounding_unit = 0.00005 np.round(1.12412/rounding_unit) * rounding_unit
你可以:
Round(X,4)
我的方法是首先指定舍入单位,然后使用如下简单技巧:
相关问题 更多 >
编程相关推荐