import numpy as np
print("np.around(2.6,decimals=1):",np.around(2.6,decimals=1))print("np.around(2.6,decimals=-1):",np.around(2.6,decimals=-1))
Run:
D:\python\python.exe C:/Users/ThinkPad/PycharmProjects/pythonProject/HelloWorld.py
np.around(2.6,decimals=1):2.6
np.around(2.6,decimals=-1):0.0
Process finished with exit code 0
np.floor(a): 返回不大于输入参数的最大整数,即i<=x
import numpy as np
print("np.floor(2.6):",np.floor(2.6))
Run:
D:\python\python.exe C:/Users/ThinkPad/PycharmProjects/pythonProject/HelloWorld.py
np.floor(2.6):2.0
Process finished with exit code 0
np.ceil(a): 返回不小于输入参数的最大整数,即i>=x
import numpy as np
print("np.ceil(2.6):",np.ceil(2.6))
Run:
D:\python\python.exe C:/Users/ThinkPad/PycharmProjects/pythonProject/HelloWorld.py
np.ceil(2.6):3.0
Process finished with exit code 0