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 Ansicht (letzte 30 Tage)
m must be a negative integer. Technically from the way that my professor phrased it, shouldn't m be -infinity?
  2 Kommentare
James Tursa
James Tursa am 14 Aug. 2018
Bearbeitet: James Tursa am 14 Aug. 2018
"... 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Vishal Chaudhary
Vishal Chaudhary am 17 Aug. 2018
Bearbeitet: Vishal Chaudhary am 17 Aug. 2018
Precision differs in MATLAB and theoretical calculation. So when you write while loop you will know the difference.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by