(both negative and non-negative) and real numbers as sequences of 0s and 1s. Int
ID: 3172283 • Letter: #
Question
(both negative and non-negative) and real numbers as sequences of 0s and 1s. Integers can be stored exactly (using binary numbers and/or 2’s
complement), but real numbers must be approximated by rational numbers. In decimal (base 10), a rational number can be expanded as, for example,
That is,
11 = 1.375. 8
11 = 1×100 +3×101 +7×102 +5×103. 8
In a similar fashion, we can expand a number in binary,
11 =···#×20 +#×21 +#×22 +#×23 +··· 8
= 1×20 +0×21 +1×22 +1×23.
Thus, we can write 11/8 as 1.011 in binary; thereby converting it to a sequence of 0s and 1s (and a
decimal—binary?—point).
(a) Is 0.01 the binary expansion of 1/2? Explain why or why not. (b) Determine the binary expansion of 25/4.
Remember that a rational number is a number that can be written as a ratio of integers, such as 1/2, 3/4, and 5/1.
Explanation / Answer
(a) 0.01 = 0*0 + 0*2^-1 +1*2^-2 = 1/4
Hence 0.01 is not the binary expansion of 1.2
(b) Binary explansion of 25/4 = 6.25 = 1*2^2+1*2^1 +0*2^0 + 0*2^-1 + 1*2^-2= 110.01
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.