“Ref math frexp”的版本间差异

本页内容
上一节: Ref_math_ldexp 下一节: Ref_math_lgamma
(创建页面,内容为“{{DISPLAYTITLE:math.frexp(x)}}28 = Python math.frexp() 方法 = Python math 模块 Python '''math.frexp(x)''' 方法以 (m, e) 对的形式返回 x 的尾数和指数。 该方法的数学公式为: number = m * 2**e。 Python 版本:2.6 === 语法 === math.frexp() 方法语法如下: <sample title="" desc="" lang="python" hererun="1"> math.frexp(x) </sample> '''参数说明:''' * '''x''' -- 必需,正数…”)
 
Neo讨论 | 贡献
无编辑摘要
 
第1行: 第1行:
{{DISPLAYTITLE:math.frexp(x)}}[[Category:python math|28]]
{{DISPLAYTITLE:math.frexp() 的反函数。}}[[Category:python math|39]]
= Python math.frexp() 方法 =
= Python math.frexp() 方法 =



2022年8月17日 (三) 21:51的最新版本

Python math.frexp() 方法

Python math 模块

Python math.frexp(x) 方法以 (m, e) 对的形式返回 x 的尾数和指数。

该方法的数学公式为: number = m * 2**e。

Python 版本:2.6

语法

math.frexp() 方法语法如下:


示例

math.frexp(x)

参数说明:

  • x -- 必需,正数或负数。如果 x 不是一个数字,返回 TypeError。

返回值

一个元组,以 (m, e) 对的形式返回 x 的尾数和指数。

==

以下实例计算一个数的尾数和指数:


示例

# 导入 math 包

import math

# 返回数字的尾数和指数

print(math.frexp(4))

print(math.frexp(-4))

print(math.frexp(7))

输出结果:


示例

(0.5, 3)
(-0.5, 3)
(0.875, 3)

Python math 模块

上一节: Ref_math_ldexp 下一节: Ref_math_lgamma
此页面最后编辑于2022年8月17日 (星期三) 21:51。