Mathematics Concepts For Computing: Number Base System
Mathematics Concepts For Computing: Number Base System
Topic Outline
Base System
Conversion of Number Bases
Computer Arithmetic
Data Representation
Data Storage
• Base Systems
Decimal System (Base 10)
Binary System (Base 2)
Octal System (Base 8)
Hexadecimal System (Base 16)
AQ010-3-1-Mathematical Concepts for Computing Number Base System Slide 4 (of 17)
Number System
• Human beings use decimal (base 10) number systems
for counting and measurements.
AQ010-3-1-Mathematical Concepts for Computing Number Base System Slide 4 (of 18)
Main Teaching Points
AQ010-3-1-Mathematical Concepts for Computing Number Base System Slide 5 (of 17)
Conversion of Integer and fraction
Decimal System to Binary System
• Integer and fraction are done separately.
• Method :
(a)Integer – repeated division by 2 and note the remainder
(answer :from bottom to up). Stop until get 0 or 1.
(b)Fraction – multiplied by 2 and the integral result is noted
(answer : from top to bottom. Stop until fractional part
become zero.
Example :
(a) 53
(b) 238.65625
Example :
(a) 1011101
(b) 1011.1001
Example :
(a) 2417
(b) 224.35
Example :
(a) 4BC
(b) A301.2F
• Example :
(a) Convert 1101110111 (base 2) to Octal.
(b) Convert 11011.10111 (base 2) to Octal.
• Example :
(a) Convert 110011010(base 2) to Hexadecimal.
(b) Convert 1011011110.1111101(base 2) to
Hexadecimal.
10768 = ?16
1 0 7 6
2 3 E
10768 = 23E16
1F0C16 = ?8
1 F 0 C
1 7 4 1 4
1F0C16 = 174148
• Computer Arithmetic
Binary Addition
Binary Subtraction
Octal Addition
Octal Subtraction
Hexadecimal Addition
Hexadecimal Subtraction
AQ010-3-1-Mathematical Concepts for Computing Number Base System Slide 6 (of 17)
Computer Arithmetic
Binary Addition
Performed in a similar way to decimal addition.
If 1+0 = 1
If 0+0 = 0
If 1 + 1 = 0 + c (c=1 need to carry to the next column to
the left)
• If 1 + 1+ 1 = 1 + c (c=1 need to carry to the next column
to the left)
• Example:
(a) 1100 + 0101
(b) 11011.01 + 101.1101
(c) 111101.01 + 111100.1
AQ010-3-1-Mathematical Concepts for Computing Number Base System
Computer Arithmetic
Binary Subtraction
• If 1 – 1 = 0
• If 0 – 1 = ( need to borrow from the adjacent left column
of digit = 1)
• If the preceding left column is 1, it will reduce to 0.
• If the preceding left column is 0, the value of this column
changes to 1 and all preceding column of 0’s changed to
1 until 1 can changed to a 0.
• Example:
(a) 1100110 – 10111
(b) 110010.00 – 101.11
(c) 1100.11 – 101.10
AQ010-3-1-Mathematical Concepts for Computing Number Base System
Computer Arithmetic
Octal Addition
Performed in a similar way to decimal addition.
if the sum exceeds 7, subtract with 8 and carrying 1 to
the next column.
Example:
(a) 5 + 4
(b) 447 + 622
(c) 37.54 + 72.74
• Example:
(a) 4251 – 3476
(b) 345 – 126
(c) 245.24 – 157.56
(d) 5004.3 – 267.14
Example:
(a) 8 + 9
(b) B83 + A2D
(c) C868 +72D9
(d) 9FB7.2 + E67.4A
• Example:
(a) 72A4 – 4E86
(b) BA3 – AB4
(c) A047.3 – B58.41
AQ010-3-1-Mathematical Concepts for Computing Number Base System Slide 8 (of 18)
Data Representation
• Take note:
1 byte = 8 bits
1 kb = 1024 byte
1 mb =1024 kb
AQ010-3-1-Mathematical Concepts for Computing Number Base System Slide 9 (of 18)
Data Representation
• Sign and Magnitude :
– Most significant bit represent sign and the rest
represent the magnitude (Absolute value).
Example :
Using 2’s complement in an 8 bits register, show how the
computer would evaluate:
a) 2310 – 1410
b) 1410 – 2310
c) - 1410 - 2310
1 2 9 10 32
S---- Sign
E----Exponent
M—Mantissa or Magnitude
• Conversion
• Computer Arithmetic
• Data Representation
• Data storage
Q&A
Set Theory