0% found this document useful (0 votes)
48 views22 pages

Lecture 3 Number Systems

This document discusses number systems and binary arithmetic. It covers topics like decimal, binary, octal and hexadecimal number systems; how computers use binary data representation and arithmetic; how numbers are physically stored and represented in different bases; conversion between number bases; binary addition and multiplication; 1's and 2's complement representation of positive and negative numbers; and representing fractions in binary.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views22 pages

Lecture 3 Number Systems

This document discusses number systems and binary arithmetic. It covers topics like decimal, binary, octal and hexadecimal number systems; how computers use binary data representation and arithmetic; how numbers are physically stored and represented in different bases; conversion between number bases; binary addition and multiplication; 1's and 2's complement representation of positive and negative numbers; and representing fractions in binary.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

CS2842 Computer Systems – Lecture III

Number Systems

Dr. Sapumal Ahangama


Department of Computer Science and Engineering

1
COUNTING AND ARITHMETIC
 Decimal or base 10 number system
 Origin: counting on the fingers
 “Digit” from the Latin word digitus meaning “finger”

 Base: The number of different digits including zero in the


number system
 Decimal (Base10) -10 digits, 0 through 9
 Binary (Base2) - 2 digits, 0 and 1
 Octal (Base8) – 8 digits, 0 through 7
 Hexadecimal (Base16)-16 digits, 0 through F
 Examples:1010=A; 1110=D

2
WHY BINARY?
 Early computer design was decimal
 Mark I and ENIAC

 John von Neumann proposed binary data processing (1945)


 Simplified computer design
 Used for both instructions and data

 Natural relationship between on/off switches and calculation


using Boolean logic

3
KEEPING TRACK OF THE BITS
 Bits commonly stored and manipulated in groups
 8 bits = 1 byte
 4 bytes = 1 word (in many systems –32 bit word size)

 Number of bits used in calculations


 Affects accuracy of results
 Limits size of numbers manipulated by the computer

4
NUMBERS: PHYSICAL REPRESENTATION
 Consider you want to represent value “5”.
 Different numerals and number systems
 Roman:V
 Arabic: 5

 Different bases to represent the same number


 510
 1012
 123

5
NUMBERS
 Example 52710

6
NUMBERS
 Example 6248

7
NUMBERS
 Example 1011112

8
CONVERSION BETWEEN DIFFERENT BASES
 Convert from Base 10 to Other Bases:
 Base 10 to Base 2
 Base 10 to Base 8
 Base 10 to Base 16

9
CONVERSION BETWEEN DIFFERENT BASES
 Convert Between Different Bases
 If not base 10
 Convert to decimal
 Convert back to needed base

 If base 10
 Conversion in previous step

 But, Conversion between base 2 and 8 and 16?


 11010111011000 to base 16
 2753318 to base 2

10
BASE OR RADIX
 Base: The number of different symbols required to represent any
given number

 The larger the base, the more numerals are required


 Base 10: 0,1,2,3,4,5,6,7,8,9
 Base 2: 0,1
 Base 8: 0,1,2,3,4,5,6,7
 Base 16: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

 For a given number, the larger the base the more symbols required,
but the fewer digits needed
 6516 to base 10 =10110
 6516 to base 8 =1458
 6516 to base 2 =11001012

11
BINARY ADDITION AND BOOLEAN LOGIC
 Adds two one-bit binary numbers (A and B)

 The output is the sum of the two bits (S) and the carry (C)

12
BINARY ADDITION AND BOOLEAN LOGIC
 Half Adder

13
BINARY ADDITION AND BOOLEAN LOGIC

 Explain the Full Adder

14
BINARY MULTIPLICATION

15
BINARY MULTIPLICATION
 Example

16
BINARY MULTIPLICATION
 Multiply the multiplicand by one bit of the multiplier at a time

 Result of the partial product for each bit is placed in such a


manner that the LSB is under the corresponding multiplier bit.

 Then add partial products are added to get


the complete product

17
1s & 2S COMPLEMENT
 1’s complement:
 Another binary number obtained by toggling all bits in it.

 2’s complement:
 1 added to the 1’s complement of the binary number.

18
Negative Numbers
 Use a sign bit
 0 for positive, 1 for negative

 Using 2’s complement:


 +5 = 00000101
 -5 = 11111011

 11111011 = -128 + 64 + 32 + 16 + 8 + 0 + 2 + 1 = -5

19
Fractions
 Example: 0.258910

20
Fractions
 A fractional number that can be represented exactly in one
number base may be impossible to be exactly represented in
another base

 0.110 in binary?
 =0.00011001100112 . . .

 0.3333310 … in base 3?
 =0.13

21
THANK YOU

22

You might also like