![](/img/trans.png)
[英]What is the smallest number that when added to the largest floating point number smaller than infinity results in infinity?
[英]In Python, why does the lowest (smallest) floating point value have different significant-digits than the largest?
我剛剛在機器學習傻瓜書中讀到,浮點變量的最小非零值是2.2250738585082014x10^-308
,最大值是1.7976931348623157x10^308
。
對此有何解釋?
為什么正面和負面指數的價值不一樣?
所有浮點數(double是雙精度浮點數)都寫成兩個值的乘積,即尾數和指數。
存儲浮點數指數的方式使用8位(對於浮點數)或11位(對於雙精度數),這意味着得到指數值-127到+128(浮點數)或-1023到+1024(雙精度)。
而2 ^ 1024給出的值為1.797693134862315907729305190789 * 10 ^ 308,這是雙精度浮點數的最大指數。
在IEEE-754浮點轉換器中進行演示
對於Python,可以在Python教程的“浮點運算: 問題和限制”頁面中找到詳細說明。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.