frexp 中文_带有Python示例的math.frexp()方法
frexp 中文
Python math.frexp()方法 (Python math.frexp() method)
math.frexp() method is a library method of math module, it is used to get the pair of mantissa and exponent of the given number, it accepts a number (integer or float) and returns a tuple of mantissa and exponent of the given number, where mantissa is a float value and exponent is an integer value.
math.frexp()方法是數學模塊的庫方法,用于獲取給定數字的尾數和指數對,它接受一個數字(整數或浮點數)并返回給定的尾數和指數的元組數字,其中尾數是浮點值,指數是整數值。
Where, the combination of mantissa and exponent should is like, number = mantissa*2**exponent.
其中,尾數和指數的組合應為: number =尾數* 2 ** exponent 。
Note: If anything is passed except the number, the method returns a type error, "TypeError: a float is required".
注意:如果傳遞了除數字以外的任何內容,則該方法將返回類型錯誤“ TypeError:需要浮點數”。
Syntax of math.frexp() method:
math.frexp()方法的語法:
math.frexp(n)Parameter(s): a – a number (float/integer).
參數: a –一個數字(浮點數/整數)。
Return value: tuple – it returns a tuple containing the mantissa and exponent part of the given number n.
返回值: tuple –返回一個包含給定數字n的尾數和指數部分的元組。
Example:
例:
Input:a = 10# function callprint(math.frexp(a))Output:(0.625, 4)Python代碼演示math.frexp()方法的示例 (Python code to demonstrate example of math.frexp() method)
# Python code demonstrate example of # math.frexp() method import math# numbers a = 0 b = 10 c = -10 d = 10.234 e = -10.234# printing the mantissa and exponent print("frexp(a): ", math.frexp(a)) print("frexp(b): ", math.frexp(b)) print("frexp(c): ", math.frexp(c)) print("frexp(d): ", math.frexp(d)) print("frexp(e): ", math.frexp(e))Output
輸出量
frexp(a): (0.0, 0) frexp(b): (0.625, 4) frexp(c): (-0.625, 4) frexp(d): (0.639625, 4) frexp(e): (-0.639625, 4)翻譯自: https://www.includehelp.com/python/math-frexp-method-with-example.aspx
frexp 中文
總結
以上是生活随笔為你收集整理的frexp 中文_带有Python示例的math.frexp()方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 彻夜怒肝!Spring Boot+Sen
- 下一篇: Java ClassLoader get