First of all, i would like to tell you all that this is my first time in blog.if you seen any error please tell me. I hope this blog can help you all and enjoy it (^ ^).
Arithmetics for Computers (Number Systems and
Operations)
2.1 NUMBER SYSTEM
2.1.1 What is
number system and basic types of number system
Number system is a basic way to represent a set of quantities. We are used to using the base-10 number system, which is also called decimal.
Other common number systems include base-16 (hexadecimal), base-8 (octal), and
base-2 (binary).
The are many types of number system
but now we only focus on decimal, hexadecimal and binary.
Graph below shows different types of
number system and its unique set of dstrict
1. Decimal number
·
Base of 10
·
Their positive
and negative values are determined by their positon weight structure(their
power of wether positive or negative). For example
2. Binary number
·
Base of 2
·
Only contain two
digits, 1 and 0 only
·
The least significant bit (LSB) and most singnificiant bit (MSB) depends on
the size binary number
3. Hexadecimal number
·
Base of 16
·
Composed number
starts from 0 to f
·
Suitable to
present in 4 bits number
4. Octal number
·
Base of 8
·
Contain number
from 0 to7
2.2 NUMBER SYSTEM CONVERSION
The table below shows the number
conversaion. We will just focus in three types, decimal,binary and hexadecimal.
Hexadecimal
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
A
|
B
|
C
|
D
|
E
|
F
|
Binary
|
0000
|
0001
|
0010
|
0011
|
0100
|
0101
|
0110
|
0111
|
1000
|
1001
|
1010
|
1011
|
1010
|
1011
|
1110
|
1111
|
Decimal
|
0
|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
|
The are many ways can be apply to
convert number system. But usualy we will by repeated divisin by base 2 ,10 and
16.
·
EXAMPLE
1.2 Binary number to Hexadecimal
number.
0011 1001 1010 0010 = 39A2
0010 1011 1000 0001.1001 1000 = 2DB1.98
1.3 Hexadecimal
Numbers to Binary Numbers
Answer :
39A2 = 0011 1001 1010 0010
2DB1.98 = 0010 1011 1000 0001.1001 1000
2.3 2’S COMPLEMENT NUMBER
2s complement method of representing number is recently use in
microprocessor-based equipment. Microprocessor must process negative and
positive number( before this we just only assume the numbers only negative).
For example,we assume in microprocessor that have 8 bits,that in MSB
(most significant bit). If the MSB bit is 0,then the number is positive (+),but
if the MSB is 1,then the number is negatve (-). While the remaining bits are
represent as the mangnitude numbers. The first bits from right is a least
significant bit (LSB).
For example :
1111 1111 255
− 0101 1111 − 95
=========== =====
1010 0000 (ones' complement) 160
+ 1 + 1
=========== =====
1010 0001 (two's complement) 161
2.4 Basic Binary Number Operation
In
this chapter,we will focus in 4 operation only, addition, subtraction, multiplication and division.
There are some rules that you should know and follow in every operations :-
Binary addition
Binary Rules
|
Sum
|
Carry
|
0 + 0 = 0
|
0
|
0
|
0 + 1 = 1
|
1
|
0
|
1 + 0 = 1
|
1
|
0
|
1 + 1 = 1
|
0
|
1
|
Binary Subtraction
Binary Rules
|
Sum
|
Borrow
|
0 - 0 = 0
|
0
|
0
|
0 - 1 = 1
|
1
|
10
|
1 - 0 = 1
|
1
|
0
|
1 - 1 = 1
|
0
|
1
|
Binary/division multiplication
(binary and division use the same
rules)
Binary Rules
|
Multiply/Division
|
0 * / 0 = 0
|
0
|
0 * / 1 = 1
|
0
|
1 * / 0 = 1
|
0
|
1 * / 1 = 1
|
1
|
2.5 Hexadecimal Number Operation
Hexadecimal addition
If
the amount of sum greater than 7 bits,then the amount if sum that exceed
to 8 will carry a 1 to the next column.
example
example
Hexadecimal Subtraction
(please
refer to this video)
No comments:
Post a Comment