Lecture 2 Bits, Bytes & Number systems


Download Lecture 2 Bits, Bytes & Number systems


Preview text

Lecture 2 Bits, Bytes & Number systems

Representation of Numbers
 Different ways to say “how many”…
 Human: decimal number system
 Radix-10 or base-10  Base-10 means that a digit can have one of ten possible values
• 0 through 9.
 Computer: binary number system
 Radix-2 or base-2  Why binary?  Each digit can have one of two values
• 0 or 1

Bits and Bytes
 A binary digit is a single numeral in a binary number.
 Each 1 and 0 in the number below is a binary digit: 1 0 0 1 0 1 0 1
 The term “binary digit” is commonly called a “bit.”
 Eight bits grouped together is called a “byte.”

Relationship between Decimal & Binary

Background:

 Number systems are positional

 There are 10 symbols that represent decimal quantities

 Multi-digit numbers are interpreted as in the following example

 79310
= 7 x 100 + 9 x 10 + 3
= 7 x 102 + 9 x 101 + 3 x 100

Remember that the position index starts from 0.

 Each place value in a decimal number is a power of 10.

 We can get a general form of this
 ABCbase  A x (base)2 + B x (base)1 + C x (base) 0

Indicate positions

Relationship between Decimal & Binary
 Binary numbers are represented using the digits 0 and 1.  Multi-digit numbers are interpreted as in the following example  101112
= 1 x 24 + 0 x 23 + 1 x 22 + 1 x 21 + 1 x 20 = 1 x 16 + 0 x 8 + 1 x 4 + 1 x 2 + 1 x 1
 Each place value in a binary number is a power of 2.

Converting binary numbers to decimal
Step 1: Starting with the 1’s place, write the binary place value over each digit in the binary number being converted.
Step 2: Add up all of the place values that have a “1” in them.
Interpret the binary number 101012 in decimal
 TRY: Interpret the binary number 010101102 in decimal

Converting decimal numbers to binary
 We have now learnt how to convert from binary to decimal
 Using positional representation
 But how about decimal to binary
 Repeated division method
• Simply keep dividing it by 2 and record the remainder • Repeat above step as many times as necessary until you get a
quotient that can’ t be divided by 2 • Remainders give the binary digits, starting from the last
remainder
 Let’s look at some examples…

Converting decimal numbers to binary
 Let’s convert decimal 23 to binary.
Step 1: 23/2 = 11 remainder 1 Step 2: 11/2 = 5 remainder 1 Step 3: 5/2 = 2 remainder 1 Step 4: 2/2 = 1 remainder 0
 The last quotient “1” cannot be divided by 2 any more. So the process ends. The final binary number is read from the very end including the last quotient: 1 0 1 1 1
 Try: Convert decimal 73, 96, 127, 128 to binary.

Hexadecimal
 Computers use binary number system because of the electric voltage (high or low voltage)
 Very difficult to express for large number representation
 Hexadecimal to rescue
 Hexadecimal system is interface between human brain and computer brain
 4 bits from binary are read together and represented using a single digit
• Such 4-bits are known as nibble • This gives a total of 16 different options
 The hexadecimal number system is a Base-16 number system:  There are 16 symbols that represent quantities:
 Represented by the symbols 0-9 and A-F where the letters represent values: A=10, B=11, C=12, D=13, E=14, and F=15

Numbering systems

Decimal
0 1 2 3 4 5 6 7

Hexadecimal
0 1 2 3 4 5 6 7

Binary
0000 0001 0010 0011 0100 0101 0110 0111

Decimal
8 9 10 11 12 13 14 15

Hexadecimal
8 9 A B C D E F

Binary
1000 1001 1010 1011 1100 1101 1110 1111

Preparing to load PDF file. please wait...

0 of 0
100%
Lecture 2 Bits, Bytes & Number systems