Python math 模块
Python math 模块提供了许多对浮点数的数学运算函数。
math 模块下的函数,返回值均为浮点数,除非另有明确说明。
如果你需要计算复数,请使用 cmath 模块中的同名函数。
要使用 math 函数必须先导入:
import math
查看 math 模块中的内容:
>>> import math
>>> dir(math)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'de