CSC 206
COMPUTER ARCHITECTURE AND
ORGANIZATION
Data representation, number bases, Fixed and
Floating-point systems representation
INTRODUCTION TO DATA
REPRESENTATION
• What is “Data Representation? Data Representation refers to
the fundamental methods and schemes used to encode, store,
and interpret all forms of information (such as numbers,
characters, images, and instructions) as sequences of binary
digits (0s and 1s) within a digital computer system. It's the set
of rules that translate human-readable information into the
machine's native language.
INTRODUCTION (WHY LEARN
REPRESENTATION)
Understanding data representation is absolutely critical in this
course because it directly underpins:
• Hardware Design
• Systems Operation
• Low-level Debugging
• Arithmetic and Logical Operations
NUMBER BASES
• What are Number Bases? A number base or radix is the
number of unique digits (including 0) used to represent
numbers.
• Common Bases:
• Binary
• Decimal
• Octal
• Hexadecimal
COMPLEMENTS
• Complement is a mathematical technique used to represent
negative numbers and perform subtraction using only addition
operations. This approach simplifies the design of digital
circuits especially in computer hardware.
• We have two types of complements
• r’s complement
• r-1 complement
COMPLEMENTS(1’S COMPLEMENT)
• The 1’s complement of a binary number is formed by flipping
all the bits – that is changing every 1 to 0 and every 0 to 1.
• Mathematically if N is an n-bit binary number, then:
• 1’s complement of N = (2n-1) – N
• Example:
• If N = 01011010, then 1,s complement = 10100101
COMPLEMENTS(2’S COMPLEMENT)
• The 2’s complement of a binary number is obtained by adding 1 to
its 1’s complement.
• Mathematical Notation:
• 2’s complement of N = 2n – N = [(2n-1) – N] + 1
• Or simply: 2’s complement of N = 1’s complement of N+1
• Example
• If N = 01011010, then 1’s complement = 10100101
• 2’s complement = 10100101 + 1 = 10100110
COMPLEMENTS(IMPORTANCE)
• Representing Negative numbers in Binary.
• Enables binary subtraction using addition.
• Simplifies circuit implementation.
• Foundation for fixed and floating-point arithmetic.
FIXED POINT REPRESENTATION
• Fixed Point Representation is a method of representing
numbers in a computer where the position of the binary (or
decimal) point is fixed and does not change. It is used to
represent integers and fractions or both, depending on where
the binary point is assumed to be.
FIXED POINT REPRESENTATION
(SIGNED AND UNSIGNED
PRESENTATION)
• Fixed – point representation stores numbers with a fixed
position for the binary point. These numbers can be:
• Unsigned, meaning only positive numbers including zero.
• Signed, meaning both positive negative numbers, using a
special method to represent the sign.
• SPECIAL METHODS
• Signed – 1’s Complement
• Signed – 2’s Complement
FLOATING POINT REPRESENTATION
• Floating-point representation Structure of a Floating-Point
is a method used to represent Number
real numbers (including
• Mantissa – also called the
fractions) in a way that can
significand or fraction: This
support very large or very
represents the actual digits of
small values by using
the number.
scientific notation in binary
form. • Exponent – tells how far to shift
the decimal (or binary) point: It
allows scaling the number up or
down.
FLOATING POINT
REPRESENTATION(NORMALIZATION)
• Normalization is the process of • Example: Convert 13 to
adjusting a binary number so normalized binary.
that it fits the format:
• Binary: 1011 -> 1101 = 1.101 *
• 1.fraction * 2 exponent
23
• This ensures the leading bit is • Normalized: 1.101 * 23
always 1
• Maximized precision by making
• Mantissa: 101
full use of the mantissa.
• Exponent: 3
FLOATING POINT REPRESENTATION
(STRUCTURE & IEEE 754)
• Floating point numbers are typically • Steps in converting numbers into
stored according to the IEEE 754 the IEEE 754 32-bit single
standard, ensuring consistent precision floating point;
representation and calculation
across different computers. • Step 1: Determine the Sign Bit(s)
• Every IEEE 754 floating-point • Step 2: Convert to Binary and
number consists of three main fields: Normalize
1. Sign Bit (S): • Step 3: Determine the Exponent
and Bias
2. Exponent Field (E)
• Step 4: Final Representation
3. Mantissa ( or Fraction) Field (M)