Basic Theories of Information PDF
Basic Theories of Information PDF
Computer System
(or Row)
(or Column)
Bit representation
4. Word
The smallest unit that represents data inside a computer
Increase operation speed
5. Number systems
Binary system is used to simplify the structure of electronic
circuits that make up a computer
Hexadecimal number is a numeric value represented by 16
numerals from “0” to “15” to ease the representation of binary
numbers for humans – computers are capable of only using
binary numbers
Numeric Systems
Also known as Base Systems or Radix
Systems
Available digits:
Decimal system (base 10)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Binary system (base 2)
0, 1
Octal system (base 8)
0, 1, 2, 3, 4, 5, 6, 7
Hexadecimal (base 16)
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
where A=10,B=11,C=12,D=13,E=14,F=15
Numeric Data
Representation
• The true value of numbers are the same
• The representation of numbers vary
– Decimal
– Binary
– Octal
– Hexadecimal
Numeric data representation
DECIMAL number 2 1 9 9 8
(Radix/Base = 10)
Weight 104 103 102 101 100
BINARY number 1 1 0 0 1
(Radix/Base = 2)
Weight 24 23 22 21 20
Value 1*24 1*23 0*22 0*21 0*20
Value
HEXA number A 2 5 7 C
(Radix/Base = 16)
Weight
Value
Result = 1001102
Binary Subtraction
Result = 10102
Hexadecimal arithmetic
4. Addition and subtraction of hexadecimal
numbers
Addition
Performed starting at the lowest (first from the
right) digit
A carry to the upper digit is performed when the
result is higher than 16
Subtraction
Performed starting at the lowest (first from the
right) digit
A borrow from the upper digit is performed when
the result is negative
Hexadecimal Addition
300010 = 3 * 10 3 Exponent
? ? 256 16 1
B. Use the answer to evaluate the decimal equivalent of
2A9D16
C. What is the highest decimal number which may be
represented by four hexadecimal digits?
D. What is the highest decimal number which may be
represented by four octal digits?
Numeric Presentation
+78910 = F7F8C916
-78910 = F7F8D916
Decimal digit representation
o Packed decimal format
1 byte represents a numeric value of 2 digits
the least significant 4 bits represent the sign
bit pattern for the sign is the same as per unpacked decimal
format
+78910 = 789C16
-78910 = 789D16
Questions
• A) Represent 7089310
– in Unpacked Decimal Format
– in Packed Decimal Format
• B) Represent 789310
– in Unpacked Decimal Format
– in Packed Decimal Format
• C) F3F9C116 is represented in standard Unpacked Decimal
Format
– What is its equivalent in decimal?
– Possible solution?
• D) 3F9C16 is represented in standard Packed Decimal
Format
– What is its equivalent in decimal?
– Possible solution?
Decimal digit representation
o Packed decimal format versus Unpacked
decimal format
A numeric value can be represented by fewer bytes
The conversion into the binary system is easy
Binary Representation
• Representation of negative integers
Absolute value representation
“0” for positive, “1” for negative
Complement representation
Decimal complement
9’s complement
10’s complement
Binary complement
1’s complement
2’s complement
Binary Representation
• Absolute value representation
– Examples
• (00001100)2 = (+12)10
• (10001100)2 = (-12)10
– Issues
• (00000000)2 = +0
• (10000000)2 = -0
– Range of values (assumption: 7-bit absolute value representation used)
• -63 to +63 equivalent to –(26-1) to +(26-1)
Binary Representation
• Complement
representation of
negative numbers
– Decimal complement
– The subtraction of each
of the digits of a
numeric value from the
complement
Binary Representation
• Binary complement
– 1’s complement of a given numeric value is the result of the
subtraction of each of the digits of this numeric value from 1, as a
result, all the “0” and “1” bits of the original bit string are switched.
Binary Representation
• Binary complement
– 2’s complement is “1’s complement” + 1
Binary Representation
• 1’s complement and 2’s complement
representation of negative numbers
Binary Representation
• Advantages of 2’s complement
– Less complicated (only one zero value)
– Range of values to be represented is wider
– Subtractions can be performed with addition circuits, simplifying
hardware structure
Binary Representation
• “1’s complement” and “2’s complement”
representation of negative integers
– range of represented numeric values when n-bit binary
number is represented by adopting the “1’s complement”
method:
-(2n-1 – 1) to (2n-1 – 1)
– range of represented numeric values when n-bit binary
number is represented by adopting the “2’s complement”
method:
-(2n-1) to (2n-1 – 1)
Binary Representation
• Addition circuits only
Binary Representation (Fixed Point)
– Fixed point
• Integer representation
– Fixed point is a data representation format used mainly
when integer type data is processed
– One word is represented in a fixed length (e.g. 16 bits and
32 bits)
– Overflow problem when attempt is made to represent a
numeric value that exceeds the fixed length allocated
• Fraction representation
– Decimal point is considered to be immediately preceded
by the sign bit
Binary Representation (Fixed Point)
– Fixed point
• Integer representation
• Range of values
-(2n-1) to (2n-1 – 1)
Binary Presentation (Fixed Point)
– Fixed point
• Fraction representation
Binary Representation (Floating Point)
– Floating point
• Used to represent real
number type data
• Used to represent
extremely large or small
size of data
Bit Shift Operations
• Using bit shifts, the multiplication and division of numeric
values can be easily performed
• Proposition Logic
• Logical operation
Proposition Logic
• A proposition is an assertion that something is the
case. We use sentences to express propositions.
• Examples:
(i) The following sentences express the same
proposition:
- “It is raining”
(ii) The following sentences express the same
proposition:
- “John loves Mary”
- “Mary is loved by John”
Proposition Logic
• Proposition will always be either “true” or “false”
• Philosophers argue a lot about what constitutes
truth. For now, we'll keep it simple:
o "P" is true if and only if P.
o "P" is false if and only if not P.
• Examples:
(i) The proposition "Snow is white" is true if and
only if snow is white.
(ii) The proposition "Snow is white" is false if
and only if snow is not white.
Proposition Logic
• Truth table
Proposition 1 Proposition 2 “If the wind blows
“The wind is blowing” “It is raining” it rains”
True True True
True False False
False True False
False False False
Proposition Logic
• Examples
p q
T T
T F p q p and q
F T T T T
F F T F F
F T F
F F F
Logical Operation
• A logical operator joins two propositions to
form a new, complex, proposition.
• The truth value of the new proposition is
determined by the truth values of the two
propositions being joined and by the
operator that joins them.
Logical Operation
• Negation
o Any proposition p can be converted into its
negation with a negation operator, producing
the new, complex, proposition:
¬p means Not p
The proposition Not p is true if and only if p is false
It is false only if p is true
Logical Operation
o Truth tables for Negation
p ¬p
T F
F T p q Not p
T T F
T F F
F T T
F F T
Logical Operation
• Logical Product
o Any two propositions p and q can be connected
with the conjunction “AND”, producing the
new, complex, proposition:
p and q (p ٨ q)
The proposition p and q is true if and only if both p
and q are true
It is false otherwise
Logical Operation
p q p٨q
T T T
T F F
F T F
F F F
Logical Operation
• Logical Sum
o Any two propositions p and q can be connected
with the conjunction “OR”, producing the new,
complex, proposition:
p or q (p ۷ q)
The proposition p and q is true if and only if either p
or q are true
It is false only if both p and q are false
Logical Operation