python ceil ceil rounded down floor rounding round log () function

Yeah modules are inside math

import math
#以下返回值都是浮点型
math.log(x,base)#默认base=e自然对数
math.ceil(x)#向上取整
math.floor(x)#向下取整
math.round(x)#四舍五入

# math.log (x) is equivalent to the mathematical ln (x), x> 0 , the number required for the base number of e, e = 2.718281828459;
# math.log10 (X) in equivalent mathematical lg (x ), x> 0, the number required for the base number of 10;

Published 10 original articles · won praise 5 · Views 922

Guess you like

Origin blog.csdn.net/qq_42774323/article/details/104942224