Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numbering System TODAY AND TOMORROW 11th Edition

Similar presentations


Presentation on theme: "Numbering System TODAY AND TOMORROW 11th Edition"— Presentation transcript:

1 Numbering System TODAY AND TOMORROW 11th Edition
Understanding Computers, 11th Edition 1

2 The Decimal and Binary Numbering System
The decimal (base 10), numbering system uses 10 symbols—the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9—to represent all possible numbers and is the numbering system people use most often. The binary (base 2), numbering system is used extensively by computers to represent numbers and other characters. This system uses only two digits—0 and 1. Chapter Understanding Computers, 11th Edition

3 Representing Data - Decimal Numbers (Base 10)
We use Decimal numbers: number based on 10 digits, 0, 1, 2, 3,…, 9 123 = (1 x 102) + (2 x 101) + (3 x 100) 764 =764(10)=7x x x100 where in base 10, digits 0,1,2,…7,8,9 are permissible (NOT 10). Note 100 = 1 In 764 the 7 is the most significant digit (MSD) and 4 is the least significant digit (LSD) Can use any Base n. Since digital work largely deals with two signals we select n=2 Binary uses the same principle Chapter Understanding Computers, 11th Edition

4 Decimal Numbers The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal numbers is ten, because only ten symbols (0 through 9) are used to represent any number. The column weights of decimal numbers are powers of ten that increase from right to left beginning with 100 =1: For fractional decimal numbers, the column weights are negative powers of ten that decrease from left to right:

5 Example Solution Decimal Numbers
Decimal numbers can be expressed as the sum of the products of each digit times the column value for that digit. Thus, the number 9240 can be expressed as      (9 x 103) + (2 x 102) + (4 x 101) + (0 x 100) or 9 x 1, x x  x 1 Example Express the number as the sum of values of each digit. Solution = (4 x 102) + (8 x 101) + (0 x 100) + (5 x 10-1) +(2 x 10-2)

6 Binary Numbers For digital systems, the binary number system is used. Binary has a radix of two and uses the digits 0 and 1 to represent quantities. The column weights of binary numbers are powers of two that increase from right to left beginning with 20 =1: For fractional binary numbers, the column weights are negative powers of two that decrease from left to right:

7 Representing Data - Binary Numbers (Base2)
The binary number 101 is: (1 x 22) + (0 x 21) + 1 = (1 x 4) + (0 x 2) + 1 = = 5 Eg 1011 = (1 x 23) + (0 x 22 ) + (1 x 21) + (1 x 20) = = 11 1(10)=001(2)= or 0x22 + 0x21 + 1x20, where 20=1 3(10)=011(2)= or 0x22 + 1x21 + 1x20 10(10)=1010(2)= or 1x23 + 0x22 + 1x21 + 0x20 29(10)= 11101(2)= or 1x24+1x23+1x22+0x21+1x20 In (2) the MSB=1 and LSD =0 Chapter Understanding Computers, 11th Edition

8 Example Solution Binary Conversions
The decimal equivalent of a binary number can be determined by adding the column values of all of the bits that are 1 and discarding all of the bits that are 0. Example Convert the binary number to decimal. Solution Start by writing the column weights; then add the weights that correspond to each 1 in the number. ½ ¼ ¼ = 37¼

9 Example Solution Binary Conversions
You can convert a decimal whole number to binary by reversing the procedure. Write the decimal weight of each column and place 1’s in the columns that sum to the decimal number. Example Convert the decimal number 49 to binary. Solution The column weights double in each position to the right. Write down column weights until the last number is larger than the one you want to convert.

10 Example Solution Binary Conversions
You can convert decimal to any other base by repeatedly dividing by the base. For binary, repeatedly divide by 2: Convert the decimal number 49 to binary by repeatedly dividing by 2. Example Solution You can do this by “reverse division” and the answer will read from left to right. Put quotients to the left and remainders on top. Answer: 1 1 remainder Quotient 1 49 2 1 3 6 12 24 Decimal number base Continue until the last quotient is 0

11 Finding Binary Form of a Decimal Number
#1- Repeatedly divide the decimal number by 2 and retain the remainder as the LSB. Find 29(10) 29/2 = 14 rem 1, LSB = 1 14/2 = 7 rem 0, next bit = 0 7/2 = 3 rem 1, next bit = 1 3/2 = 1 rem 1, next bit = 1 1/2 = 0 rem 1, MSB = 1 So, 29(10) = 11101 #2- Find the largest power of 2 less than the number. That becomes the MSD. Subtract these numbers and repeat the process. 24 = 16, (MSB), = 13, 23 = 8, 13-8=5, 22 = 4, 5-4=1, 20 = 1, LSB Therefore 29(10) = 11101 Chapter Understanding Computers, 11th Edition

12 Base n Binary – 2 Octal – 8 Decimal – 10 Hexadecimal – 16
When dealing with collection of bits like binary words representing text characters using the ASCII (American Standard Code for Information Interchange) code – it is inconvenient to deal with each individual bit So may use octal (3 bit) words or hexadecimal (4 bit) words Chapter Understanding Computers, 11th Edition

13 The Hexadecimal Numbering System
The hexadecimal numbering system is also called the base 16 numbering system because it uses 16 different symbols. Hexadecimal is not itself a code that the computer uses to perform computations or to communicate with other machines. As you can see in Figure 1, each hex character has a 4-bit binary counterpart, so any combination of 8 bits can be represented by exactly two hexadecimal characters. For example, the letter N (represented in ASCII by ) has a hex representation of 4E (see the Binary Equivalent column in Figure 1). Chapter Understanding Computers, 11th Edition

14 Chapter 7 Understanding Computers, 11th Edition

15 Converting Between Numbering Systems: Hexadecimal to Decimal
similar to converting a binary number to decimal, except the base number is 16 instead of 2. To determine the decimal equivalent of a hexadecimal number : multiply the decimal equivalent of each individual hex character by the appropriate power of 16 and then add the results to obtain the decimal equivalent of that hex number. Chapter Understanding Computers, 11th Edition

16 Hexadecimal - Base 16 Base 16, using first 16 numerals including 6 letters: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Because 16 is a power of 2, can use octal numbers to represent a group of 4 bits Example: = = = 6210 3E16 = 3x = 6210 Chapter Understanding Computers, 11th Edition

17 Summary Example Solution Hexadecimal Numbers
Binary Hexadecimal Numbers A B C D E F Hexadecimal uses sixteen characters to represent numbers: the numbers 0 through 9 and the alphabetic characters A through F. Large binary number can easily be converted to hexadecimal by grouping bits 4 at a time and writing the equivalent hexadecimal character. Express in hexadecimal: Example Solution Group the binary number by 4-bits starting from the right. Thus, 960E

18 Summary { Example Solution Hexadecimal Numbers
Binary Hexadecimal Numbers A B C D E F Hexadecimal is a weighted number system. The column weights are powers of 16, which increase from right to left. { . Column weights . Example Express 1A2F16 in decimal. Start by writing the column weights: Solution A F16 1(4096) + 10(256) +2(16) +15(1) = 670310

19 Hexadecimal to Binary / Binary to Hexadecimal
To convert from hexadecimal to binary, we convert each hexadecimal digit separately to 4 binary digits Example, to convert F6A9 to binary, we get F 6 A 9 or in binary representation. To convert from binary to hexadecimal, we go through the reverse process. If the number of digits in the binary number is not divisible by 4, we add leading zeros to the binary number to force an even division. F Example, to convert the binary number to hexadecimal, we get B or lB53 in hexadecimal representation. Note that three leading zeros were added to change the initial 1 to 0001 before making the conversion. Chapter Understanding Computers, 11th Edition

20 Decimal to Binary/Decimal to Hexadecimal
Use the remainder method. The decimal number is divided by 2 (to convert to a binary number) or 16 (to convert to a hexadecimal number). The remainder of the division operation is recorded and the division process is repeated using the quotient as the next dividend, until the quotient becomes 0. At that point, the collective remainders (written backwards) represent the equivalent binary or hexadecimal number (see Figure 3). Chapter Understanding Computers, 11th Edition

21 Chapter 7 Understanding Computers, 11th Edition

22 Chapter 7 Understanding Computers, 11th Edition

23 Octal - Base 8 Base 8, using first 8 numerals: 0, 1, 2, 3, 4, 5, 6, 7
Because 8 is a power of 2, can use octal numbers to represent a group of 3 bits Example: = = 3910 478 = 4x8 + 7 = 3910 Chapter Understanding Computers, 11th Edition

24 Summary Example Solution Octal Numbers
Decimal Octal Binary Octal Numbers Octal uses eight characters the numbers 0 through 7 to represent numbers. There is no 8 or 9 character in octal. Binary number can easily be converted to octal by grouping bits 3 at a time and writing the equivalent octal character for each group. Express in octal: Example Solution Group the binary number by 3-bits starting from the right. Thus,

25 Summary { Example Solution Octal Numbers
Decimal Octal Binary Octal Numbers Octal is also a weighted number system. The column weights are powers of 8, which increase from right to left. { . Column weights . Example Express in decimal. Start by writing the column weights: Solution 3(512) + 7(64) +0(8) +2(1) = 198610

26 Computer Arithmetic Note that with binary and
hexadecimal, as in decimal arithmetic, you carryto and borrow from the column to the left as needed as you move from right to left. Instead of carrying or borrowing 10, however—as you would in the decimal system—you carry or borrow 2 (binary) or 16 (hexadecimal). Chapter Understanding Computers, 11th Edition

27 Quiz 1. For the binary number 1000, the weight of the column with the 1 is a. 4 b. 6 c. 8 d. 10 2. The hexadecimal number 2C has a decimal equivalent value of a. 14 b. 44 c. 64 d. none of the above Chapter Understanding Computers, 11th Edition © 2009 Pearson Education


Download ppt "Numbering System TODAY AND TOMORROW 11th Edition"

Similar presentations


Ads by Google