Which number cannot be represented exactly on a digital computer?

A digital computer stores fractions as a finite number of bits b 1 , b 2 , b 3 , , b n b_1, b_2, b_3, \ldots , b_n representing

b 1 2 + b 2 2 2 + + b n 2 n . \frac{b_1}{2} + \frac{b_2}{2^2} + \cdots + \frac{b_n}{2^n}.

Which of the following numbers cannot be represented exactly in this manner?

0.1 0.125 0.25 0.5

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

A computer stores decimal numbers as sums of inverse powers of 2. So, 0.5 would be stored as 0.10000 = 1 1 / 2 0.10000=1*1/2 , 0.25 would be stored as 0.01000 = 0 1 / 2 + 1 1 / 2 2 0.01000=0*1/2+1*1/2^2 , and 0.125 would be stored as 0.001000 = 0 1 / 2 + 0 1 / 2 2 + 1 1 / 2 3 0.001000=0*1/2+0*1/2^2+1*1/2^3 . However, 0.1 cannot be written exactly as a finite sum of inverse powers of 2. We can see that to represent 0.1 in binary we will have to select inverse powers of 2 which are less than 0.125. However, we observe that all such numbers or their sums will always end with 5, i.e, 0.0625, 0.0625+0.03125 = 0.09375. The sum of inverse powers of 2 will always have 5 in the last decimal place. Therefore 0.1 cannot be represented exactly.

However, 0.1 cannot be written exactly as a finite sum of inverse powers of 2.

How do you know this is true?

Pi Han Goh - 3 years, 10 months ago

Log in to reply

Hi Pi Han Goh. Thanks for your comment. I have now edited my solution to make the answer more convincing.

Thiruvikraman Kandhadai - 3 years, 9 months ago
Hana Wehbi
Aug 11, 2017

If we consider b = 1 b=1 , we notice that

b 2 = 0.5 \frac{b}{2}= 0.5 ,

b 2 2 2 = 0.25 \frac{b_2}{2^2}= 0.25 and

b 3 2 3 = 0.125 \frac{b_3}{2^3}= 0.125 ;

therefore there exists no element equals to b 10 = 0.1 \frac{b}{10}=0.1

You have only shown that 0.125, 0.25, and 0.5 are possible. How do you know that 0.1 is not possible as well?

Pi Han Goh - 3 years, 10 months ago

I see the problem got edited but if we look at it right now, l see a geometric progression series whose ratio is 0.5 0.5 , therefore 0.1 0.1 can't be an element of this series, because every element is in the form of 1 2 n \frac{1}{2^n} for n = 1 , 2 , 3 , n=1,2,3,\dots

Hana Wehbi - 3 years, 10 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...