Python Math

Python math.trunc() 方法

阅读(360)

Python math.trunc(x) 方法返回 x 截断整数的部分,即返回整数部分,忽略小数部分。 math.trunc(x) 方法不会将数字向上/向下舍入到最接近的整数,而只是删除小数。 语法 math.trunc() 方法语法如下:...

Python math.tanh() 方法

阅读(463)

Python math.tanh(x) 返回 x 的双曲正切值。 Python 版本: 1.4 语法 math.tanh() 方法语法如下: math.tanh(x) 参数说明: x -- 必需,个正数或负数。如果 x 不是一个数字,返回 ...

Python math.tan() 方法

阅读(349)

Python math.tan(x) 返回 x 弧度的正切值。 Python 版本: 1.4 语法 math.tan() 方法语法如下: math.tan(x) 参数说明: x -- 必需,数字。如果 x 不是数字,则返回 TypeErro...

Python math.sqrt() 方法

阅读(586)

Python math.sqrt(x) 方法返回 x 的平方根。 数字必须大于等于 0。 语法 math.sqrt() 方法语法如下: math.sqrt(x) 参数说明: x -- 必需,数字。如果 x 不是一个数字,返回 TypeErr...

Python math.sinh() 方法

阅读(403)

Python math.sinh(x) 返回 x 的双曲正弦值。 Python 版本: 1.4 语法 math.sinh() 方法语法如下: math.sinh(x) 参数说明: x -- 必需,个正数或负数。如果 x 不是一个数字,返回 ...

Python math.sin() 方法

阅读(434)

Python math.sin(x) 返回 x 弧度的正弦值。 要获取指定角度的正弦,必须首先使用 math.radians() 方法将其转换为弧度。 Python 版本: 1.4 语法 math.sin() 方法语法如下: math.si...

Python math.remainder() 方法

阅读(335)

Python mathremainder(x, y) 方法返回 x/y 的余数。 Python 版本:3.7 语法 math.remainder() 方法语法如下: math.remainder(x, y) 参数说明: x -- 必需,被除...

Python math.radians() 方法

阅读(411)

Python math.radians(x) 方法将角度 x 从度数转换为弧度。 math.degrees() 方法将弧度值转换为度数。 Python 版本: 2.0 语法 math.radians() 方法语法如下: math.radia...

Python math.prod() 方法

阅读(358)

Python math.prod() 方法用于计算可迭代对象中所有元素的积。 Python 版本:3.8 语法 math.prod() 方法语法如下: math.prod(iterable, start) 参数说明: iterable --...

Python math.pow() 方法

阅读(431)

Python math.pow(x, y) 方法返回返回 x 的 y 次幂( 次方 )。 如果 x 为负且 y 不是整数,则返回 ValueError。该方法会将两个参数转换为浮点数。math.pow(1.0,x) 或 math.pow(x...