フィルターのクリア

Write a Matlab program by using a while loop that finds the smallest positive number 2^m such that 1+x>1 in the machine.

1 回表示 (過去 30 日間)
m must be a negative integer. Technically from the way that my professor phrased it, shouldn't m be -infinity?
  2 件のコメント
OCDER
OCDER 2018 年 8 月 13 日
Theoretical math and computer math are slightly different. You might find that 1+2^m > 1 will fail. https://www.cs.drexel.edu/~introcs/Fa15/extras/Rounding/index.html
James Tursa
James Tursa 2018 年 8 月 14 日
編集済み: James Tursa 2018 年 8 月 14 日
"... shouldn't m be -infinity?"
2^(-infinity) = 0, and 1+0 is not greater than 1. So, no, the way the professor phrased it, -infinity is not the answer.
Do as the professor instructed and write some code with a while loop to figure out the answer.

サインインしてコメントする。

回答 (1 件)

Vishal Chaudhary
Vishal Chaudhary 2018 年 8 月 17 日
編集済み: Vishal Chaudhary 2018 年 8 月 17 日
Precision differs in MATLAB and theoretical calculation. So when you write while loop you will know the difference.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by