Can the double-precision floating point number 0.72 be represented exactly in Matlab? Explain.
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Can the double-precision floating point number 0.72 be represented exactly in Matlab? Explain. This is one of my practice problems for the test and the answer does not make sense to me.
This was his answer
No, because its mantissa has non-zero bits beyond the 52 bits allowed. It has the following repeating pattern for the significand: 10111000010100011110.
0 Kommentare
Antworten (1)
Roger Stafford
am 5 Mär. 2017
Bearbeitet: Roger Stafford
am 5 Mär. 2017
In almost all computers, floating point numbers are represented in binary format. This means that the only numbers that can be represented exactly are the rational numbers in which the reduced form denominator is some power of two, such as 35/128. The number .72 in reduced fraction form would be 18/25, which is clearly not of the required form. It is analogous to trying to represent 1/3 exactly in a decimal calculator - it can’t be done because in decimal the number looks like this:
1/3 = .33333333333333 .... infinitely far out
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical 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!