Download 02 - Fundamental 2 - programming computing and more Study Guides, Projects, Research Programming Paradigms in PDF only on Docsity!
Lecture 02: Number System
Objectives
- (^) Explain the number system used in computers
- Learn about the digit symbols, base, and representation
forms of various number systems developed and used
- Explain the method of number system conversions
- Explain binary codes and their classifcation
1. Introduction to Number Systems
- (^) Long ago, humans used sticks to count;
they then learned how to draw pictures of
sticks on the ground and eventually on
paper. So, the number 5 was frst
represented as: | | | | | (for fve sticks)
- (^) One of the best ways to represent a
number today is by using the modern
decimal system. Why?
Subset of the complex numbers
2. Base of a Number System
- (^) The base , or radix , of any number
system is determined by the number
of digit symbols in the system.
- (^) For example, binary is a base-
number system since it uses two
symbols and decimal is a base-
system since it uses ten symbols.
3. Weighting Factor
- (^) The numerical value of a number is the sum
of the products obtained by multiplying each
digit by the weight of its respective position.
- (^) The position of each digit in a sequence has
a certain numerical weight, and each digit is
a multiplier of the weight of its position. The
decimal number system is hence an
example of a weighted, positional number
system. The weight of each position is a
power of the base number 10
4. Types of Number Systems
4.2. Binary number system [Base- 2]
- (^) The binary number system uses TWO symbols to represent numerical values. These are 0 and 1 with 0 having the least value and 1 having the greatest value
4.2. Binary number system [Base- 2]
- (^) In a computer, a binary digit representing a binary value (0 or 1) is called a BIT. That is, each digit in a binary number is called a bit, 4 bits form a NIBBLE, 8 bits form a BYTE, two bytes form a WORD and two words form a DOUBLE WORD (rarely used). An n -bit number can represent 2 n^ different number values, for example, for an 8-bit number, 2^8 = 256 different values may be represented
4.4 Hexadecimal number system [Base-16]
- (^) The hexadecimal number
system uses SIXTEEN
symbols to represent
numbers. The symbols
are 0, 1, 2, 3, 4, 5, 6, 7,
8, 9, A, B, C, D, E, and F
with 0 having the least
value and F having the
greatest value
4.4 Hexadecimal number system [Base-16]
4.5 Common rules of number systems
- (^) Rule 3 Each position multiplies the value of the digit symbol by the base raised to the power of the value equal to the digit symbol position. Examples: Decimal system—consider the number 125 = 1 × 10^2 + 2 × 10^1 + 5 × 10^0 Rule 4 A carry from one position to the next increases its weight base times. Examples: Decimal system—consider the number 5—5 = 5 × 10^0 or 5 ones. Moving the number, one place, to the left, it becomes— 5 × 10^1 or 5 tens or 50. Binary system—consider the number 1—1 = 1 × 2^0 or 1 one Moving the number, one place, to the left, it becomes— 1 × 2^1 or two 1’s or 10
4.5 Common rules of number systems
5. Number System Conversions
- (^) Conversion of a decimal number to its binary equivalent
- (^) Method 1 (Method 2 in page 33 chapter 2 of reference book) Repeated division by 2 method
- Divide the dividend, that is, the decimal number by two and obtain the quotient and remainder.
- Divide the quotient by two and obtain the new quotient and remainder.
- Repeat step 2 until the quotient is equal to zero (0).
- The frst remainder produced is the least signifcant bit (LSB) in the binary number and the last remainder is the most signifcant bit (MSB). Accordingly, the binary number is then written (from left to right) with the MSB occurring first (list the remainder values in reverse order). This is the binary equivalent.
5. Number System Conversions