Numeral System and Its Importance: Hong@Is - Naist.Jp
Numeral System and Its Importance: Hong@Is - Naist.Jp
Numeral System and Its Importance: Hong@Is - Naist.Jp
Importance
HONG@IS.NAIST.JP
ROOM: B405
Contents
Number System Introduction
Number systems used by human
Number systems used by computer
For business activities Whole number and Natural number are developed, ex: 0,1,2,305, etc.
4
Number systems used by human
To share the foods Fractional number have been developed, ex: 1/5, 1/2, etc.
5
Number systems used by human
𝜋𝑅2
𝑅 1 √𝟐
6
Number systems used by human
a,b: real numbers a+jb Complex Number 1 + j2, 1.54 – j0.3, etc
j: imaginary unit (j2 = -1)
Whole number
Natural Number
7
Number systems used by Computer
Electronic circuit or computer operates based on the on-off switch of
electric current. The basic number system of computer is BINARY
number. ON 1
OFF 0
i = 1 0 -1 -2
Example: N = (13.25)10 can be written as:
N = 1×101 + 3×100 + 2×10-1 + 5×10-2
i = 2 1 0 -1-2-3-4
N = (101.1101)2 can be rewritten as:
N = 1×22 + 0×21 + 1×20 + 1×2-1 + 1×2-2 + 0×2-3 +1×2-4
N = 1×22 + 1×20 + 1×2-1 + 1×2-2 + 1×2-4
11
Exercise 4-1
Write the polynomial notation of the following numbers:
N = (101.1101)2 N = ?
N = (765.02)8 N = ?
N = (25.5)10 N = ?
12
Exercise 4-1: Answer
i = 2 1 0 -1-2-3-4
N = (101.1101)2 N = 1×22 + 1×20 + 1×2-1 + 1×2-2 + 1×2-4
Or, N = 1×22 + 0×21 + 1×20 + 1×2-1 + 1×2-2 + 0×2-3 + 1×2-4
i = 2 1 0 -1-2
N = (765.02)8 N = 7×82 + 6×81 + 5×80 + 0×8-1 + 2×8-2
i = 1 0 -1
N = (25.5)10 N = 2×101 + 5×100 + 5×10-1
13
Number conversions
14
Number conversions
Convert from base-B to base-10 (B can be 2, 8, 16):
Two steps: n 1
◦ Step 1: Write the polynomial notation of base-B number N
i m
ai r i
◦ Step 2: Calculate the polynomial using base-10 arithmetic
15
Exercise 4-2
Convert the following numbers into base-10:
(11011011)2 = (??)10
(25)8 = (??)10
16
Exercise 4-2: Answer
(11011011)2 = (??)10
(11011011)2 = 1×27 + 1×26 + 1×24 + 1×23 + 1×21 + 1×20
= 128 + 64 + 16 +8 +2 +1
= (219)10
(25)8 = (??)10
(25)8 = 2×81 + 5×80 = 16 + 5 = (21)10
17
Number conversions
Convert from base-10 to base-B
integer fraction
(N)10 = (A)B
22
Exercise 4-3: Answer
23
Contents
Number System Introduction
Number systems used by human
Number systems used by computer
25
Signed number Representation
- Signed magnitude representation-
Signed magnitude representation:
Sign bit: commonly represented by the most significant bit
(MSB) (0 mean positive, 1 means negative).
Magnitude: represented by the remained bits. It shows the
absolute value of the number. Sign
bit magnitude
MSB 0
26
Signed number Representation
- Ones’ Complement -
The ones’ complement form of a negative binary number is the bitwise NOT of its positive
number. Ex: (5)10 = (0101)2 (-5)10 = (1010)2
If using N bits to represent a number its range will be -(2N-1 - 1) to (2N-1 - 1)
Steps to add two numbers:
Do conventional binary addition
Add an end-around carry
Problems:
Multiple zeros (0000 or 1111)
End-around carry
Example:
27
Signed number Representation
- Two’s Complement (1/2) -
To avoid the end-around carry and multiple zeros problem, the two’s
complement has been introduced and widely used.
The negative number is done by inverting all the bits and adding 1 to
the result.
There is only one zero: 00000
Method to find the negation of a number in two’s complement
Method 1: Method 2:
Invert all the bits Find the first ‘1’ (start from right)
Add the result to 1 Invert all the bits in the left of that ’1’.
Example: Find (-3)10 = (?)2 using 4 bits Example: Find (-3)10 = (?)2
Invert: 0011 (3) 1100 Find the first ‘1’: 0011 (3)
Add 1: 1100 + 1 = 1101 (-3) Invert all the left bits: 0011 1101 (-3)
28
Signed number Representation
- Two’s Complement (2/2) -
Add two number in two’s complement format:
Perform the binary adding
Ignore the last carry bit.
For example: Perform the following additions using 4 bits
1 0 1 0 (-6) 0 0 1 1 (3)
+ 0 1 0 1 (5) + 1 1 1 0 (-2)
----------- -----------
1 1 1 1 (-1) 1 0 0 0 1 (1)
29
Exercise 4-4
Find the signed magnitude representation of the following
numbers (using 5 bits):
if (7)10 = (00111)2 (-7)10 = (?)2
if (10)10 = (01010)2 (-10)10 = (?)2
Find the ones’ complement of the following numbers (using 5 bits)
(-7)10 = (?)2 (-10)10 = (?)2
Find the negation of the following two’s complement numbers:
0111010 1010011 110111010
30
Exercise 4-4: Answer
Find the signed magnitude representation of the following
numbers (using 5 bits):
if (7)10 = (00111)2 (-7)10 = (10111)2
if (10)10 = (01010)2 (-10)10 = (11010)2
Find the ones’ complement of the following numbers (using 5 bits)
(-7)10 = (11000)2 (-10)10 = (10101)2
Find the negation of the following two’s complement numbers:
0111010 1010011 110111010
1000110 0101101 001000110
31
Contents
Number System Introduction
Number systems used by human
Number systems used by computer
t=m+f t=m+f+1
33
Floating Point Number
Floating point number is a formula representation of a real number in trade-
off between Range and Precision
𝒔𝒊𝒈𝒏𝒊𝒇𝒊𝒄𝒂𝒏𝒅 × 𝒃𝒂𝒔𝒆−𝒆𝒙𝒑𝒐𝒏𝒆𝒏𝒕
For example: 𝟏𝟒𝟓𝟐 × 𝟏𝟎−𝟑 = 𝟏. 𝟒𝟓𝟐 𝟏𝟒𝟓𝟐 × 𝟏𝟎−𝟐 = 𝟏𝟒. 𝟓𝟐
It means that the radix point can “float”.
In computer, only base 2 can be used.
t = a + b + 1 bits
35
Exercise 4-5: Answer
Find the equivalent decimal values of the following
unsigned fixed point numbers (m = 4, f = 4, t = 8):
(1001.1100)2 = (9.75)10
Find the equivalent decimal values of the following
signed fixed point numbers (m = 3, f = 4, t = 8):
(1 001.1100)2 = (- 1.75)10
Find the equivalent decimal values of the following
floating point numbers (a = 3, b = 4, t = 8):
(0 011 0101)2 = (+ 5×2-3)10 = (0.625)
36
Contents
Number System Introduction
Number systems used by human
Number systems used by computer
4-bit adder
38
Size of Number: Complexity vs. Performance
39
Sent 10,000 bits 100 bit error
40
Contents
Number System Introduction
Number systems used by human
Number systems used by computer