NUMBER SYSTEM
A number system is a basic symbol
to represent a set of quantities.
1.1~ Basic types of
number system
1.2 ~ Number system base:
The maximum number that can be represented on
the single digit or number is called a base.
Ø DECIMAL
NUMBER
ü Most widely used by modern civilizations.
ü The prefix “deci-” stands for 10
ü Base of 10 because:
· There are 10 symbols that
represent quantities (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
· Each place value in a
decimal number is a
ü The value of assigned weight is composed
by 10digits starting from 0 until 9.
ü The positive and negative values are
determined by their position weight structure(power of a number):
ü most basic number system that most machines (and
electricaldevices) use to communicate.
ü Base of 2
because each position in the number represent an incremental number with a base
of 2.
ü Since the
number system is represented in “twos”, there are only 2 numbers that can
be a value in each position of the base-2 number.
ü Each position
can only contain a 0 or a 1.
ü The least
significant bit (LSB) and most significant bit (MSB) is depend on the size of
binary number.
ü The hexadecimal number system is used as an intermediary
system in computers, such as arepresentation of memory addresses or a
representation of colors
ü Base of 16
because each position in the number represents an incremental number
with a base of 16.
ü Since the number system is represented in “sixteen”, there
are only 10 numbers and 6 letters (0-9, A-F) that can be a value
in each position of the base-16 number.
1.3 ~
Number system conversion :
Converting Binary Numbers to Decimal
•Step1
– Starting with the 1s place,
write the binary place value over each digit in the binary number being converted
:
•Step2
– Add up all of
the place values that have a “1” in the binary number
*EXAMPLE
Convert the following binary number to decimal number :
Converting decimal Numbers to binary
• There are two
methods that can be used to convert decimal numbers to binary:
v Repeated
subtraction method
v Repeated division
method
• Both methods produce the same result and you should use whichever
one you are most comfortable with .
Repeated
subtraction method
As an explanation of the repeated subtraction method, let’s
convert the decimal number 204 to binary.
Step 1:
• Starting with the 1s place, write down all of the binary place
values in order until you get to the first binary place value that is GREATER
THAN the decimal number you are trying to convert.
Step 2:
• Mark out the largest place value (it just tells us how many
place values we need).
Step 3:
• Subtract the largest place value from the decimal number.
Place a “1” under that place value.
Step 4:
• For the rest of the
place values, try to subtract each one from the previous result.
– If
you can, place a “1” under that place value.
– If
you can’t, place a “0” under that place value.
Step 5:
• Repeat Step 4 until all
of the place values have been processed.
– The
resulting set of 1s and 0s is the binary equivalent of the
decimal number you started with.
* EXAMPLE
Convert the following decimal number
to binary using repeated subtraction method :
a) 18910
b) 38.312510=3810+0.312510
Repeated
division method
Step1:
• Divide the decimal number you’re
trying to convert by 2 in regular long division until you have a final
remainder.
Step2:
• Use the first remainder as the LEAST
SIGNIFICANT DIGIT of the binary number.
Step3:
•Divide the quotient you got from the
first division operation until you have a final remainder.
Step4:
•Use the remainder as the next digit
of the binary number.
Step5:
• Repeat Steps 3 & 4
as many times as necessary until you get a quotient that can’t be divided by 2.
Step6:
•Use the last remainder (the one that
can’t be divided by 2) as the MOST SIGNIFICANT digit.
* EXAMPLE
Convert the following decimal number to binary using repeated
division method
a) 33910
b) 59.62510
Converting Binary Numbers
to Hexadecimal
•Step1:
– Starting
with the LEAST SIGNIFICANT digit, mark off the digits in groups of
4.
– For example, to convert 110101001011 to hexadecimal, mark off the digits in
groups of
four.
• 1101 | 0100 | 1011
•Step2:
– Convert each
group of four digits to its hexadecimal character.
•HelpfulHint
– The last
group on the left can have anywhere from 1 to 4 binary digits group.
– If it will
help you see the pattern, you can fill in enough leading zeroes to make the
last group on the left have four digits.
– For example,
1 1 0 | 0 1 1 1 | 1 0 0 1 could be written
as
0 1 1 0 | 0 1 1 1 | 1 0 0 1
* EXAMPLE
Convert the following binary number to hexadecimal:
a) 11111012= 011111012
b) 10011111001.1012=010011111001.01002
Converting Hexadecimal to Binary Numbers
• Converting hexadecimal numbers to binary is just the reverse operation of
converting binary to hexadecimal.
• Just convert
each hexadecimal digit to its four-bit binary pattern. The resulting set of 1s
and 0s is the binary equivalent of the hexadecimal number.:
* EXAMPLE
Convert the following hexadecimal to binary number:
a) AF025E16
b) 3B5D2A716
Converting Hexadecimal to Decimal
• Step 1
– Starting with the 1s place,
write the hexadecimal place value over each digit in the hexadecimal being converted
• Step 2
– Add up all of
the place values that have a value in the hexadecimal
* EXAMPLE
Convert the following hexadecimal to decimal:
a) 3DA416
b) 123D.216
Converting Decimal to Hexadecimal
• There are two methods to
choose from: –
Do a decimal-to-binary conversion and then a binary-to-hexadecimal
conversion.
– Do a direct
conversion using the repeated division method. • Since
this is a conversion to hexadecimal, 16 is the divisor each time.
decimal-to-binary conversion and
then a binary-to-hexadecimal conversion
* EXAMPLE
Convert 13610 to
hexadecimal
Step 1:
convert it to binary number
Step 2:
convert the binary number to hexadecimal
direct conversion
using the repeated division method
* EXAMPLE
Convert 83610 to
hexadecimal
1.4~ 2’S complement
number:
1st and 2nd Complement of Binary Numbers
ü They are important because they permit the
representation of negative numbers
ü The method of 2nd complement
arithmetic is commonly used in computers handle negative numbers.
ü Assume that a microprocessor have 8 register bits,
figure below show the sign bit or the most significant bit ( MSB ) if the MSB
bit is 0 , then the number is positive (+) . Conversely, if the MSB is 1 , then
the number is negative (-). The others remaining 7 bits are represent as the
magnitude numbers.
1st Complement of Binary Numbers
v The 1st complement of a binary number is found by changing
all 1s to 0s and all 0s to 1s by using parallel inverters (NOT circuits).
v Example :
2nd Complement of Binary Numbers
v
The 2nd complement of a binary number is found by adding 1 to
LSB of the 1s complement.
v Example :
v
Another method for finding 2nd complement of a binary number
by:
§ Start at the right
with the LSB and write the bits as they are up to and including the first 1
§ Take the 1st
complement of the remaining bits
wWritten by:Woon Pei Wen,Loo Shi Min
MMatrix no.:B031210273,B031210106