2. Number System
Number
It is a symbol representing a unit or quantity.
Number System
Defines a set of symbols used to represent
quantity
Radix
The base or radix of number system determines
how many numerical digits the number system
uses.
3. Types of Number System
Decimal System
Binary Number System
Octal Number System
Hexadecimal Number System
4. Decimal Number System
Ingenious method of expressing all numbers
by means of tens symbols originated from
India. It is widely used and is based on the
ten fingers of a human being.
It makes use of ten numeric symbols
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
5. Inherent Value and Positional Value
The inherent value of a symbol is the value of that
symbol standing alone.
Example 6 in number 256, 165, 698
The symbol is related to the quantity six, even if it is used in
different number positions
The positional value of a numeric symbol is
directly related to the base of a system.
In the case of decimal system, each position has a
value of 10 times greater that the position to its right.
Example: 423, the symbol 3 represents the ones (units), the
symbol 2 represents the tens position (10 x 1), and the symbol
4 represents the hundreds position (10 x 10). In other words,
each symbol move to the left represents an increase in the
value of the position by a factor of ten.
6. Inherent and Positional Value cont.
2539 = 2X1000 + 5X100 + 3X10 + 9X1
= 2X103 + 5X102 + 3X101 + 9 x100
This means that positional value of symbol 2 is
1000 or using the base 10 it is 103
7. Binary Number System
Uses only two numeric symbols 1 and 0
Under the binary system, each position has a
value 2 times greater than the position to the
right.
8. Octal Number System
Octalnumber system is using 8 digits to
represent numbers. The highest value = 7.
Each column represents a power of 8. Octal
numbers are represented with the suffix 8.
9. Hexadecimal Number System
Provides another convenient and simple
method for expressing values represented by
binary numerals.
It uses a base, or radix, of 16 and the place
values are the powers of 16.
10. Decimal Binary Hexadecimal Decimal Binary Hexadecimal
0 0000 0 8 1000 8
1 0001 1 9 1001 9
2 0010 2 10 1010 A
3 0011 3 11 1011 B
4 0100 4 12 1100 C
5 0101 5 13 1101 D
6 0110 6 14 1110 E
7 0111 7 15 1111 F
11. Radix Conversion
The process of converting a base to another.
To convert a decimal number to any other
number system, divide the decimal number
by the base of the destination number
system. Repeat the process until the quotient
becomes zero. And note down the
remainders in the reverse order.
To convert from any other number system to
decimal, take the positional value, multiply by
the digit and add.
14. Decimal to Binary Conversion
of Fractions
Division – Multiplication Method
Steps to be followed
Multiply the decimal fraction by 2 and noting the
integral part of the product
Continue to multiply by 2 as long as the resulting
product is not equal to zero.
When the obtained product is equal to zero, the binary
of the number consists of the integral part listed from
top to bottom in the order they were recorded.
15. Example 1: Convert 0.375 to its binary
equivalent
Multiplication Product Integral part
0.375 x 2 0.75 0
0.75 x 2 1.5 1
0.5 x 2 1.0 1
0.37510 is equivalent to 0.0112
16. Exercises
Convertthe following decimal numbers into
binary and hexadecimal numbers:
1. 128
2. 207
Convertthe following binary numbers into
decimal and hexadecimal numbers:
1. 11111000
2. 1110110
21. Data Representation
Data on digital computers is represented as a
sequence of 0s and 1s. This includes
numeric data, text, executable files, images,
audio, and video.
Data can be represented using 2n
Numeric representation
Fixed point
Floating point
Non numeric representation
22. Fixed Point
Integers are whole numbers or fixed-point
numbers with the radix point fixed after the
least-significant bit.
Computers use a fixed number of bits to
represent an integer. The commonly-used
bit-lengths for integers are 8-bit, 16-bit, 32-bit
or 64-bit.
Two representation
24. Unsigned magnitude
Unsigned integers can represent zero and positive
integers, but not negative integers.
Example 1: Suppose that n=8 and the binary pattern
is 0100 0001, the value of this unsigned integer is
1×2^0 + 1×2^6 = 65.
Example 2: Suppose that n=16 and the binary
pattern is 0001 0000 0000 1000, the value of this
unsigned integer is 1×2^3 + 1×2^12 = 4104.
An n-bit pattern can represent 2^n distinct integers.
An n-bit unsigned integer can represent integers
from 0 to (2^n)-1
25. Signed magnitude
The most-significant bit (msb) is the sign bit,
with value of 0 representing positive integer
and 1 representing negative integer.
The remaining n-1 bits represents the
magnitude (absolute value) of the integer.
The absolute value of the integer is
interpreted as "the magnitude of the (n-1)-bit
binary pattern".
26. Signed magnitude
Example 1: Suppose that n=8 and the binary
representation is 0 100 0001.
Sign bit is 0 ⇒ positive
Absolute value is 100 0001 = 65
Hence, the integer is +65
Example 2: Suppose that n=8 and the binary
representation is 1 000 0001.
Sign bit is 1 ⇒ negative
Absolute value is 000 0001 = 1
Hence, the integer is -1
27. Signed magnitude
Example 3: Suppose that n=8 and the binary
representation is 0 000 0000.
Sign bit is 0 ⇒ positive
Absolute value is 000 0000 = 0
Hence, the integer is +0
Example 4: Suppose that n=8 and the binary
representation is 1 000 0000.
Sign bit is 1 ⇒ negative
Absolute value is 000 0000B = 0
Hence, the integer is -0
28.
29. Drawbacks
Thedrawbacks of sign-magnitude
representation are:
There are two representations (0000 0000B and
1000 0000B) for the number zero, which could
lead to inefficiency and confusion.
Positive and negative integers need to be
processed separately.
30. One’s Complement
The most significant bit (msb) is the sign bit, with
value of 0 representing positive integers and 1
representing negative integers.
The remaining n-1 bits represents the magnitude
of the integer, as follows:
for positive integers, the absolute value of the integer
is equal to "the magnitude of the (n-1)-bit binary
pattern".
for negative integers, the absolute value of the integer
is equal to "the magnitude of the complement
(inverse) of the (n-1)-bit binary pattern" (hence called
1's complement).
31. One’s complement
Example 1: Suppose that n=8 and the binary
representation 0 100 0001.
Sign bit is 0 ⇒ positive
Absolute value is 100 0001 = 65
Hence, the integer is +65
Example 2: Suppose that n=8 and the binary
representation 1 000 0001.
Sign bit is 1 ⇒ negative
Absolute value is the complement of 000
0001B, i.e., 111 1110B = 126
Hence, the integer is -126
32.
33. Two’s complement
Again, the most significant bit (msb) is the sign
bit, with value of 0 representing positive integers
and 1 representing negative integers.
The remaining n-1 bits represents the magnitude
of the integer, as follows:
for positive integers, the absolute value of the integer
is equal to "the magnitude of the (n-1)-bit binary
pattern".
for negative integers, the absolute value of the integer
is equal to "the magnitude of the complement of the
(n-1)-bit binary pattern plus one" (hence called 2's
complement).
34. Two’s complement
Example 1: Suppose that n=8 and the binary
representation 0 000 0000.
Sign bit is 0 ⇒ positive
Absolute value is 000 0000 = 0
Hence, the integer is +0
Example 2: Suppose that n=8 and the binary
representation 1 111 1111.
Sign bit is 1 ⇒ negative
Absolute value is the complement of 111
1111B plus 1, i.e., 000 0000 + 1 = 1
Hence, the integer is -1
35.
36. Floating point representation
A real number is represented in exponential
form (a = +- m x re)
1 bit 8 bits 23 bits (single precision)
0 10000100 11010000000000000000000
Sign Exponent Mantissa
Radix
point
38. COMPLEMENTS
Complements are used in digital computers
for simplifying the subtraction operation and
for logical manipulations
2 types for each base-r system
1) r’s complement (Radix complement)
2) (r-1)’s complement (Diminished radix
Complement)
39. Radix Complement
Referred to as r’s complement
The r’s complement of N is obtained as (rn)-N
where
r = base or radix
n = number of digits
N = number
40. Example
Give the 10’s complement for the following number
a. 583978
b. 5498
Solution:
a. N = 583978
n=6
106 - 583978
1,000,000 – 583978 = 436022
b. N = 5498
n=4
104 - 5498
10, 000 – 5498 = 4502
41. Diminished Radix Complements
Referred to as the (r-1)s complement
The (r-1)s complement of N is obtained as (rn-
1)-N where
r = base or radix
n = number of digits
N = number
Therefore 9’s complement of N is (10n-1)- N
42. Example
Give the (r-1)’s complement for the following
number if n=6
a. 567894
b. 012598
44. A.) N = 567894
999,999 – 567894 = 432105
Therefore, the 9’s complement of 567894
is 432105.
B.) N = 012598
999,999 – 012598 = 987401
Therefore, the 9’s complement of 012598
is 987401.
45. Diminished Radix Complement
Inthe binary number system r=2 then r-1 = 1
so the 1’s complement of N is (2n-1)-N
When a binary digit is subtracted from 1, the
only possibilities are 1-0=1 or 1-1=0
Therefore, 1’s complement of a binary numeral
is formed by changing 1’s to 0’s and 0’s to
1’s.
46. Example
Compute for the 1’s complement of each of the
following binary numbers
a. 1001011
b. 010110101
Solution:
a. N=1001011
The 1’s complement of 1001011 is 0110100
b. N=010110101
The 1’s complement of 010110101 is 101001010
47. Subtraction with Complements
The subtraction of two n-digit unsigned numbers M
– N in base r can be done as follows:
1. Add the minuend M to the r’s complement of
the subtrahend N.
If the M >= N, the sum will produce an end carry,
rn, which is discarded; what is left is the result M –
N
If M < N, the sum does not produce an end carry
ans is equal to rn – (N – M), which is the r’s
complement of (N – M). To obtain the answer,
take the r’s complement of the sum and place a
negative sign in front.
48. Using 10’s complement, subtract 72532 –
3250.
M = 72532
10’s complement of N = + 96750
Sum = 169282
Discard end carry 105 = - 100000
Answer = 69282
49. Using
10’s complement, subtract 3250 –
72532.
M = 03250
10’s complement of N = + 27468
Sum = 30718
There is no end carry.
Answer = -69282
Get the 10’s complement of 30718.
51. Exercise
Giventwo binary numbers X = 1010100 and
Y = 1000011, perform the subtraction (a) X –
Y and (b) Y – X using 2’s complements and
1’s complement.
52. Binary Codes
Decimal Digit (BCD) Excess-3
8421
0 0000 0011
1 0001 0100
2 0010 0101 In a digital system,
3 0011 0110 it may sometimes
represent a binary
4 0100 0111
number, other
5 0101 1000 times some other
6 0110 1001 discrete quantity of
information
7 0111 1010
8 1000 1011
9 1001 1100
53. Non Numerical
Representations
Itrefers to a representation of data other than
numerical values. It refers to the
representation of a character, sound or
image.
54. Standardizations of Character
Codes
Codename Description
EBCDIC Computer code defined by IBM for
general purpose computers. 8 bits
represent one character.
ASCII 7 bit code established by ANSI
(American National Standards
Institute). Used in PC’s.
ISO Code ISO646 published as a
recommendation by the International
Organization for Standardization
(ISO), based on ASCII
7 bit code for information exchange
Unicode An industry standard allowing
computers to consistently represent
characters used in most of the
countries. Every character is
represented with 2 bytes.
55. Image and Sound
Representations
Still Images GIF Format to save graphics, 256 colors
displayable
JPEG Compression format for color still
images
Moving Pictures Compression format for color moving pictures
MPEG-1 Data stored mainly on CD ROM
MPEG-2 Stored images like vide; real time
images
MPEG-4 Standardization for mobile terminals
Sound PCM
MIDI Interface to connect a musical
instrument with a computer.
56. Operations and Accuracy
Shift operations
It is the operation of shifting a bit string to the right
or left.
Arithmetic Shift Logical Shift
Left Arithmetic Left Shift Logical left shift
Right Arithmetic Right Shift Logical Right Shift
57. Arithmetic Shift
Arithmetic Shift is an operation of shifting a bit string,
except for the sign bit.
Example : Shift bits by 1
ALS ARS
Sign bit overflow
overflow
11111010 11111010
Sign bit
11110100 11111101
Insert a zero in the vacated spot
58. Logical Shift
It shifts a bit string and inserts “0” in places made
empty by the shift.
Perform a logical left shift. Shift by 1 bit.
01111010
Perform a logical right shift. Shift by 1 bit.
10011001
59. Exercise
Perform arithmetic right and logical right
shifts by 3 bits on the 8th binary number
11001100.
Notes de l'éditeur
When the value of the base is substituted… -2’s and 1’s complement for binary numbers -10’s and 9’s complement for decimal numbers