Limitations of storing numbers
Integer Representation
Definition: Whole numbers without fractional components (e.g., 120, 10, 0, -20).
Binary Representation:
Uses bits to store integers.
4-bit Example: 0 (sign) 111 (value) represents 7.
6-bit Example: 0 (sign) 11111 (value) represents 31.
Overflow
Definition: Exceeding the maximum storage capacity of a system.
Example: In a 4-bit system, adding 1 to 7 causes overflow.
6-bit System Overflow:
Operations causing overflow: 3 + 29, 24 + 6, 15 + 15.
Floating-Point Representation
Definition: Represents non-integers using base 2 (similar to scientific notation).
64-bit System:
1 bit for sign, 11 bits for exponent, 52 bits for the number.
Example: 0.375 in binary floating-point.
Roundoff Errors
Definition: Precision loss due to inability to fully represent certain numbers in binary.
Example: Adding 0.1 three times may not equal 0.3 exactly.
Summary
Integers: Stored using bits, watch for overflow.
Floating-Point Numbers: Used for non-integers, limited by precision.
Modern Systems: 64-bit architecture provides high precision for critical applications.