Number Systems
Basic Definitions
Section titled “Basic Definitions”Number Bases
Section titled “Number Bases”- Binary (Base 2): Uses digits 0, 1
- Octal (Base 8): Uses digits 0-7
- Decimal (Base 10): Uses digits 0-9
- Hexadecimal (Base 16): Uses digits 0-9, A-F
Key Concepts
Section titled “Key Concepts”- Positional Number System: Each digit’s value depends on its position
- Multiple Representations: Same binary pattern can represent different values depending on the number system used
- Example:
could be 10, -2, -5, or -6
- Example:
Base Conversions
Section titled “Base Conversions”Binary to Decimal
Section titled “Binary to Decimal”Use positional notation:
Binary to Octal
Section titled “Binary to Octal”Group binary digits in sets of 3 (from right):
Binary to Hexadecimal
Section titled “Binary to Hexadecimal”Group binary digits in sets of 4 (from right):
Other Examples
Section titled “Other Examples”Negative Binary Numbers
Section titled “Negative Binary Numbers”Three Main Approaches
Section titled “Three Main Approaches”- Sign-and-Magnitude
- Ones’-Complement
- Two’s-Complement
Common Features
Section titled “Common Features”- MSB (Most Significant Bit) is the sign bit:
0
= Positive1
= Negative
Two’s-Complement (Preferred Method)
Section titled “Two’s-Complement (Preferred Method)”- Advantages:
- Widely used in modern systems
- Simplifies arithmetic operations
- Only one representation for zero
- Process: To get negative of a number:
- Invert all bits (ones’-complement)
- Add 1 to the result
Binary Numbers with Decimals
Section titled “Binary Numbers with Decimals”Fractional Binary Representation
Section titled “Fractional Binary Representation”- Uses negative powers of 2 for digits after the binary point
- Example:
Converting Decimal Fractions to Binary
Section titled “Converting Decimal Fractions to Binary”Method: Multiply by 2, take integer part, repeat with fractional part
- Example: Convert
to binary → 0 → 1 → 1 - Result:
Limitations
Section titled “Limitations”- Some decimal fractions cannot be exactly represented in binary
- Example:
(repeating) - This leads to precision issues in computer calculations
Floating Point Numbers
Section titled “Floating Point Numbers”IEEE 754 Standard
Section titled “IEEE 754 Standard”The most common floating point representation:
Single Precision (32-bit)
Section titled “Single Precision (32-bit)”Sign | Exponent | Mantissa/Significand |
---|---|---|
1 | 8 | 23 |
Double Precision (64-bit)
Section titled “Double Precision (64-bit)”Sign | Exponent | Mantissa/Significand |
---|---|---|
1 | 11 | 52 |
Components
Section titled “Components”- Sign Bit: 0 for positive, 1 for negative
- Exponent: Biased representation (actual exponent + bias)
- Single: bias = 127
- Double: bias = 1023
- Mantissa: Fractional part (normalized, implicit leading 1)
Formula
Section titled “Formula”Special Values
Section titled “Special Values”- Zero: Exponent = 0, Mantissa = 0
- Infinity: Exponent = all 1s, Mantissa = 0
- NaN (Not a Number): Exponent = all 1s, Mantissa ≠ 0
- Denormalized: Exponent = 0, Mantissa ≠ 0
Example
Section titled “Example”Single precision representation of
- Convert to binary:
- Normalize:
- Sign: 0 (positive)
- Exponent:
- Mantissa:
A/D and D/A Conversion
Section titled “A/D and D/A Conversion”- Real-world signals: Continuous/analog form
- Digital systems: Model these as 0s and 1s
- Conversion needed: Between analog and digital representations