数学库 math
上一节
下一节
math 数学库中的常数
常数 | 值 |
pi | 3.14159265359 |
e | 2.71828182818 |
inf | 无穷大 (infinity) |
nan | 非浮点数(Not a Number) |
math 数学库中的函数
函数 | 描述 |
fabs(x) | x 的绝对值 |
fmod(x , y) | 余数 ( x % y ) |
fsum([a,b,c,……]) | 和 |
gcd(x, y) | x y 的最大公约数 |
trunc(x) | x 的整数部分 |
ceil(x) | 刚好大于等于 x 的整数 |
floor(x) | 刚好小于等于 x 的整数 |
factorial(x) | x 的阶乘 |
pow(x , y) | x 的 y 次方 |
sin(x) | |
cos(x) | |
tan(x) | |
hypot( x , y) | (x , y)到原点的距离 |
这个程序的结果是?
from math import *
print( pow(9, 99) > -inf )
下面这个程序,在求什么?
from math import *
print( factorial(13) )

