Number Systems and Binary Representation Notes
Introduction to Number Systems
- Number systems are crucial for computer representation of data.
- Binary Number System: Represents numbers using only two digits, 0 and 1.
Finite Precision Numbers
- Limited digit representation (e.g., 3 decimal digits: 000 to 999) leads to:
- Upper limit: Numbers larger than 999 cannot be represented.
- Non-positive integers: Negative numbers cannot be expressed.
- Rational numbers: Fractions (e.g., 1/2) are not representable.
- Irrational numbers: (e.g., √2) cannot be exactly expressed.
- Complex numbers: Cannot be represented using basic number systems.
Radix Number Systems
- Radix: Refers to the base of a number system. Examples include:
- Radix 2 – Binary
- Radix 10 – Decimal
Conversion between Radix
Decimal to Other Systems: Understand how to convert a decimal number into binary, octal, and hexadecimal systems.
- Example: Convert 2001 into binary, octal, hexadecimal.
Grouping for Conversion:
- Hexadecimal: Group binary bits in sets of 4.
- Octal: Group binary bits in sets of 3.
Methods of Conversion
Decimal to Binary via Successive Halving:
- Example: Converting 1492 by repeatedly dividing by 2 to obtain remainders.
Binary to Decimal via Successive Doubling:
- Example: Converting binary number 101110110111 to decimal by doubling the previous result and adding corresponding bits.
Representing Negative Numbers
- Four Methods for negative number representation:
- Signed Magnitude:
- Convert to binary; first bit indicates sign (0 for positive, 1 for negative).
- Problem: Double representation of 0 (e.g., 0000 for +0 and 1000 for -0).
- One’s Complement:
- Invert bits: 0s to 1s and vice versa.
- Problem: Double representation of 0.
- Two’s Complement:
- Invert bits and add 1. E.g., -3 is represented as 1101.
- Advantage: No double representation of 0.
- Excess (or Bias) Representation:
- Store number as value + $2^{(m-1)}$ for m bit numbers. E.g., for m=4, -3 is stored as 5 (0101).
Binary Arithmetic
- Arithmetic operations (addition, subtraction, multiplication, division) can also be performed with binary numbers.
- Binary Addition Table: Used in calculations.
- Addition in One’s and Two’s complement needs to be practiced.
Further Topics
- Characters representation in binary using ASCII and other formats will be discussed later in the course.
- Practice in tutorials for binary operations will be available in subsequent weeks.