gdb ldexp_帶有Python示例的math.ldexp()方法

gdb ldexp

Python math.ldexp()方法 (Python math.ldexp() method)

math.ldexp() method is a library method of math module, it is used to calculate expression x*(2**i), where x is a mantissa and i is an exponent. It accepts two numbers (x is either float or integer, i is an integer) and returns the result of the expression x*(2**i)).

math.ldexp()方法數學模塊的庫方法,用于計算表達式x *(2 ** i) ,其中x是尾數, i是指數。 它接受兩個數字( x是浮點數或整數, i是整數),并返回表達式x *(2 ** i)的結果

Note: There is a method in math module math.frexp() that is used to get the pair of mantissa and exponent in a tuple. The math.ldexp() method is an inverse of math.frexp() method. In other words, w can understand that math.frexp() method returns mantissa and exponent of a number and math.ldexp() method reforms/creates the number again using x – mantissa and i – exponent.

注意: 數學模塊math.frexp()中有一種方法可用于獲取元組中的尾數對和指數對。 math.ldexp()方法與math.frexp()方法相反。 換句話說,w可以理解math.frexp()方法返回數字的尾數和指數,而math.ldexp()方法再次使用x –尾數和i –指數來重整 /創建數字。

Syntax of math.ldexp() method:

math.ldexp()方法的語法:

    math.ldexp(x, i)

Parameter(s): x, i – the numbers to be calculated the expression "x*(2**i)".

參數: x,i –要計算的數字,表達式為“ x *(2 ** i)”

Return value: float – it returns a float value that is the result of expression "x*(2**i)".

返回值: float-它返回一個浮點值,該值是表達式“ x *(2 ** i)”的結果

Example:

例:

    Input:
x = 2
i = 3
# function call
print(math.ldexp(x,i))
Output:
16.0 # (x*(2**i) = (2*(2**3)) = 16

Python代碼演示math.ldexp()方法的示例 (Python code to demonstrate example of math.ldexp() method)

# python code to demonstrate example of 
# math.ldexp() method
# importing math module
import math
# number
x = 2
i = 3
# math.ldexp() method
print(math.ldexp(x,i))
x = 0
i = 0
# math.ldexp() method
print(math.ldexp(x,i))
x = 0.625
i = 4
# math.ldexp() method
print(math.ldexp(x,i))
x = -0.639625
i = 4
# math.ldexp() method
print(math.ldexp(x,i))

Output

輸出量

16.0
0.0
10.0
-10.234

區分math.frexp()和math.ldexp()方法的Python代碼 (Python code to differentiate the math.frexp() and math.ldexp() methods)

Here, we have a number a and finding it's mantissa and exponent as a pair (x, i), and again making the same number by using math.ldexp() method that calculates the expression (x*(2**i))

在這里,我們有一個數字a,并找到它的尾數和指數對(x,i) ,然后再次使用math.ldexp()方法來計算表達式(x *(2 ** i)

# python code to demonstrate example of 
# math.ldexp() method
# importing math module
import math
a = 10
frexp_result = math.frexp(a)
print("frexp() result: ", frexp_result)
# extracing its values
x = frexp_result[0]
i = frexp_result[1]
print("Extracted part from frexp_result...")
print("x = ", x)
print("i = ", i)
# now using method ldexp()
ldexp_result = math.ldexp(x,i)
print("ldexp() result: ", ldexp_result)

Output

輸出量

frexp() result:  (0.625, 4)
Extracted part from frexp_result...
x =  0.625
i =  4
ldexp() result:  10.0

翻譯自: https://www.includehelp.com/python/math-ldexp-method-with-example.aspx

gdb ldexp

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/542988.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542988.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542988.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

windows安裝包刪了會有影響嗎_win7系統刪除系統更新安裝包的詳細教程

win7系統使用久了,好多網友反饋說win7系統刪除系統更新安裝包的問題,非常不方便。有什么辦法可以永久解決win7系統刪除系統更新安裝包的問題,面對win7系統刪除系統更新安裝包的圖文步驟非常簡單,只需要1.其實在win7旗艦版系統中&a…

解壓android img文件怎么打開,解壓壓縮android img文件

boot.imgboot和recovery映像并不是一個完整的文件系統,它們是一種android自定義的文件格式,該格式包括了2K的文件頭,后面緊跟著是用gzip壓縮過的內核,再后面是一個ramdisk內存盤,ramdisk映像是一個最基礎的小型文件系統…

Java String 學習筆記 (一)

2019獨角獸企業重金招聘Python工程師標準>>> ###String 簡介 String 并非java的8大基本數據類型之一。 java中基本數據類型存儲在棧內存中。而String不是,新new的String 對象存儲在堆內存中。而字符串存儲在常量池中。String對象的引用存儲中棧內存中。 …

tau nb_math.tau常數,帶Python示例

tau nbPython math.tau常數 (Python math.tau constant) math.tau constant is a predefined constant, which is defined in math module, it returns the value of mathematical constant "τ" (Tau), the value is 6.283185307179586 math.tau常數是在數學模塊中定…

pcl畫圓球_PCL之軌跡繪制(二)

之前學習點云庫做一些簡單的應用都是直接復制demo的代碼,然后把導入文件改一下,今天嘗試自己寫一些程序,結果錯漏百出,難受的早上,不過堅持了下來,求夸~~~這個主要是一個…

note2 android4.3,玩家們動手吧 Note2安卓4.3固件已泄漏

【PConline 資訊】最近各個牌子的安卓機迎來了升級安卓4.3的大潮,現在三星Galaxy Note2的安卓4.3固件已經泄漏出來了。實際上,此前三星官方已經確認,Galaxy Note3可以獲得官方的安卓4.3固件升級,但具體日期沒有確定,只…

SDP學習筆記

一、SDP規范了回話描述的格式,一般結合會話協議共同工作。 常見的會話傳送協議包括:SAP(Session Announcement Protocol 會話公告協議),SIP,RTSP,HTTP,和使用MIME的E-Mail。 (PS:對SAP只能包含一個會話描述,其它會話協議的SDP可包含多個會話描…

sinh_帶有Python示例的math.sinh()方法

sinhPython math.sinh()方法 (Python math.sinh() method) math.sinh() method is a library method of math module, it is used to get the hyperbolic sine of given number in radians, it accepts a number and returns hyperbolic sine. math.sinh()方法是數學模塊的庫方…

android serviceconnection unbind流程,Android unbindService 流程分析

基于Android 6.0的源碼剖析, 分析bind service的啟動流程。/frameworks/base/core/java/android/app/ContextImpl.java/frameworks/base/core/java/android/app/LoadedApk.java/frameworks/base/core/java/android/app/IServiceConnection.aidl(自動生成Binder兩端)…

【JUnit 報錯】 method initializationerror not found:JUnit4單元測試報錯問題

今天是用JUnit測試一段代碼,報錯method initializationerror not found::出現如下問題: 雙擊這個就顯示出現如下的錯誤: 查詢網上,說是junit版本的問題: 那我就不使用JUnit這個Libernary了,下載…

flash 不顯示 旋轉 補間動畫_【圖片】Flash入門5:詳解制作補間動畫(非傳統補間)【flash軟件吧】_百度貼吧...

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓●●關于補間動畫●●●1、準備事項注意:像 Flash 中的大多數內容一樣,動畫不需要任何 ActionScript。然而,如果您愿意,您可以使用 ActionScript 創建動畫。在創建補間之前&#xff0…

math.ceil帶小數點_Python中帶有示例的math.ceil()方法

math.ceil帶小數點Python math.ceil()方法 (Python math.ceil() method) math.ceil() method is a library method of math module, it is used to get the ceil value of a given number, it accepts a number/numeric expression and returns the smallest integral value wh…

將byte數組以html形式輸出到頁面,java 數組顯示到html

java 數組顯示到html[2021-02-05 01:08:54] 簡介:php去除nbsp的方法:首先創建一個PHP代碼示例文件;然后通過“preg_replace("/(\s|\&nbsp\;| |\xc2\xa0)/", " ", strip_tags($val));”方法去除所有nbsp即可。推薦:…

JDK各版本新增的主要特性

JDK1.5新特性: 1.自動裝箱與拆箱: 2.枚舉 3.靜態導入,如:import staticjava.lang.System.out 4.可變參數(Varargs) 5.內省(Introspector),主要用于操作JavaBean中的屬性&…

oracle 導入sql文件 漢字亂碼_將現有的sql腳本導入 Oracle 數據庫,中文亂碼問題...

將現有的sql 腳本導入 Oracle數據庫比如 在windows 系統下,可以寫一個 bat 來實現直接導入如:bat 中的內容如下,logs.log 將會記錄執行日志sqlplus user/passworddbname create.sql > logs.logcreate.sql 中的內容可以是需要執行的sql 語句…

html圖片多邊形怎么寫,使用CSS3構建的圖像多邊形裁剪動畫特效

CSS語言:CSSSCSS確定html {background: #333;}.polygon {-webkit-clip-path: polygon(50% 0%, 79.38926% 9.54915%, 97.55283% 34.54915%, 97.55283% 65.45085%, 79.38926% 90.45085%, 50% 100%, 20.61074% 90.45085%, 2.44717% 65.45085%, 2.44717% 34.54915%, 20.…

python函數示例_帶Python示例的complex()函數

python函數示例Python complex()函數 (Python complex() function) complex() function is a library function in Python, it is used to get the complex number from given a real number or/and an imaginary number (which is an optional part), it accepts either a rea…

windows 下 git 禁用 CRLF 轉換 LF

2019獨角獸企業重金招聘Python工程師標準>>> windows中的換行符為 CRLF, 而在linux下的換行符為LF,所以在執行add . 時出現提示,解決辦法: 刪除根目錄 .git 文件夾禁用自動轉換 > git config --global core.autocrl…

cmd執行sql文件路徑 oracle_oracle 基礎 執行sql文件

Oracle執行外部文件:sql>new.sql執行多個sql文件:1.把所有的文件都放在同一個目錄下,然后在命令行里執行命令:c:>dir/b > d:/1.sql會把所有的sql文件名都輸出到一個sql文件中。2.用UltraEdit打開生成的sql文件,altC切換到…

獲取天氣html,使用htmlparser獲取sohu的天氣預報

首先,我們新建一個類,存放天氣信息/** Created on 2005-3-8** To change the template for this generated file go to* Window>Preferences>Java>Code Generation>Code and Comments*/packageorg.exoplatform.portlets.chinaweather.compon…