フィルターのクリア

1e301-10^301 ~= 0 ?

8 ビュー (過去 30 日間)
Robin Lindström
Robin Lindström 2016 年 8 月 14 日
回答済み: Walter Roberson 2016 年 8 月 14 日
Why does 1e301-10^301 not equal zero in matlab, but 1e300-10^300 does?
1e301-10^301 is 1.18961352678223e+285.

採用された回答

Walter Roberson
Walter Roberson 2016 年 8 月 14 日
1e301 is computed entirely at parse time, as a double precision number.
10^301 involves computing 10 and 301 at parse time, each as double precision numbers, and then computing the one to the power of the other at run time, resulting in a double precision number. As this is a floating point calculation, it is subject to standard floating point roundoff .
1e301 comes out as the first representable double precision number greater than 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 and 10^301 is one bit different, coming out as the last representable double precision number less than 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 . 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 itself is not exactly representable in double precision.

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 8 月 14 日

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by