



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The binary, octal, and hexadecimal number systems, their significance in computing, and how to convert numbers between these bases. It covers decimal, binary, octal, and hexadecimal representations of numbers, including real numbers and character strings.
Typology: Schemes and Mind Maps
1 / 7
This page cannot be seen from the preview
Don't miss anything!
We noted in several places that a binary scheme having only the two binary digits 0 and 1 is used to represent information in a computer. In PART OF THE PIC- TURE: Data Representation in Chapter 2, we described how these binary digits, called bits, are organized into groups of 8 called bytes, and bytes in turn are grouped together into words. Common word sizes are 16 bits (= 2 bytes) and 32 bits (= 4 bytes). Each byte or word has an address that can be used to access it, making it possible to store information in and retrieve information from that byte or word. In this appendix we describe the binary number system and how numbers can be converted from one base to another. The number system that we are accustomed to using is a decimal or base- number system, which uses the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The significance of these digits in a numeral depends on the positions that they occupy in that nu- meral. For example, in the numeral
485 the digit 4 is interpreted as 4 hundreds and the digit 8 as 8 tens and the digit 5 as 5 ones
Thus, the numeral 485 represents the number four-hundred eighty-five and can be written in expanded form as
or
The digits that appear in the various positions of a decimal (base-10) numeral, thus, are coefficients of powers of 10. Similar positional number systems can be devised using numbers other than 10 as a base. The binary number system uses 2 as the base and has only two digits, 0 and 1. As in a decimal system, the significance of the bits in a binary numeral is de- termined by their positions in that numeral. For example, the binary numeral
101
can be written in expanded form (using decimal notation) as
(1 3 22 ) 1 (0 3 21 ) 1 (1 3 20 )
that is, the binary numeral 101 has the decimal value
Similarly, the binary numeral 111010 has the decimal value
When necessary, to avoid confusion about which base is being used, it is custom- ary to write the base as a subscript for nondecimal numerals. Using this conven- tion, we could indicate that 5 and 58 have the binary representations just given by writing
and
Two other nondecimal numeration systems are important in the consideration of computer systems: octal and hexadecimal. The octal system is a base-8 system and uses the eight digits 0, 1, 2, 3, 4, 5, 6, and 7. In an octal numeral such as
the digits are coefficients of powers of 8; this numeral is therefore an abbreviation for the expanded form
and thus has the decimal value
A hexadecimal system uses a base of 16 and the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A (10), B (11), C (12), D (13), E (14), and F (15). The hexadecimal numeral
has the expanded form
which has the decimal value
Table A3.1 shows the decimal, binary, octal, and hexadecimal representations for the first 31 nonnegative integers. In the decimal representation of real numbers, digits to the left of the decimal point are coefficients of nonnegative powers of 10, and those to the right are coeffi- cients of negative powers of 10. For example, the decimal numeral 56.317 can be written in expanded form as
or, equivalently, as
of two, and those to the right are coefficients of negative powers of two. For exam- ple, the expanded form of 110.101 2 is
and thus has the decimal value
Similarly, in octal representation, digits to the left of the octal point are coefficients of nonnegative powers of eight, and those to the right are coefficients of negative powers of eight. And in hexadecimal representation, digits to the left of the octal point are coefficients of nonnegative powers of sixteen, and those to the right are coefficients of negative powers of sixteen. Thus, the expanded form of 102.34 8 is
which has the decimal value
The expanded form of 1AB.C8 16 is
whose decimal value is
Convert each of the binary numerals in exercises 1 โ 6 to base ten.
1. 1001 4. 111111111111111 (fifteen 1s) 2. 110010 5. 1. 3. 1000000 6. 1010.
Convert each of the octal numerals in exercises 7 โ 12 to base ten.
7. 23 9. 2705 11. 10000 8. 77777 10. 7.2 12. 123.
Convert each of the hexadecimal numerals in exercises 13 โ 18 to base ten.
13. 12 15. 1AB 17. ABC 14. FFF 16. 8.C 18. AB.CD 19 โ 24. Converting from octal representation to binary representation is easy, as we need only replace each octal digit with its three-bit binary equiva- lent. For example, to convert 617 8 to binary, replace 6 with 110, 1 with 001, and 7 with 111, to obtain 110001111 2. Convert each of the octal nu- merals in exercises 7 โ 12 to binary numerals.
25 โ 30. Imitating the conversion scheme in exercises 19 โ 24, convert each of the hexadecimal numerals in exercises 13 โ 18 to binary numerals. 31 โ 36. To convert a binary numeral to octal, place the digits in groups of three, starting from the binary point, or from the right end if there is no binary point, and replace each group with the corresponding octal digit. For ex- ample,. Convert each of the binary nu- merals in exercises 1 โ 6 to octal numerals. 37 โ 42. Imitating the conversion scheme in exercises 31 โ 36, convert each of the binary numerals in exercises 1 โ 6 to hexadecimal numerals.
One method for finding the base- b representation of a whole number given in base-ten notation is to divide the number repeatedly by b until a quotient of zero results. The successive remainders are the digits from right to left of the base- b rep- resentation. For example, the binary representation of 26 is 11010 2 , as the following computation shows:
Convert each of the base-ten numerals in exercises 43 โ 46 to (a) binary, (b) octal, and (c) hexadecimal:
43. 27 45. 99 44. 314 46. 5280
To convert a decimal fraction to its base- b equivalent, repeatedly multiply the frac- tional part of the number by b. The integer parts are the digits from left to right of the base- b representation. For example, the decimal numeral 0.6875 corresponds to the binary numeral 0.1011 2 , as the following computation shows:
Convert each of the base-ten numerals in exercises 47 โ 51 to (a) binary, (b) octal, and (c) hexadecimal:
47. 0.5 50. 16. 48. 0.25 51. 8. 49. 0.
Assuming the representation of character strings described in the section PART OF THE PICTURE: Data Representation in Chapter 2 and using the table of ASCII characters in appendix A, indicate how each of the character strings in exer- cises 74 โ 79 would be stored in 4-byte words.
74. to 76. Amount 78. J. Doe 75. FOUR 77. etc. 79. A#*4โC