Floating/Fixed Point Binary Flashcards
What is Overflow?
Overflow occurs when a number exceeds the maximum value that can be represented.
What is Underflow?
Underflow happens when the number is smaller than the minimum representable value which could happen or small negative values.
Fixed-Point vs Floating-Point
Fixed-Point:
* Very accurate
* Limited Range
* Faster and more efficient
* Less Memory Usage
* Simple, real-time tasks
Floating-Point:
* Flexible precision
* Very wide range
* Slower the uses more resources
* Uses More Memory
* Complex Calculations
What is Fixed-Point Representation?
A way to represent real numbers as integers with a fixed position for the decimal point. The number of bits used for the integer and fractional parts is fixed.
How are Fixed-Point Numbers Stored?
A fixed number of bits are allocated for the integer and fractional parts. Example: In an 8-bit system with 4 bits for integer and 4 bits for fractional, the number is split as
xxxx. yyyy
(integer and fractional part).
Range of Fixed-Point Representation?
Formula for Range: For an N-bit system with I integer bits and F fractional bits:
Maximum = 2^(I-1) - 2^-F
Minimum = -2^(I-1) + 2^-F (for signed numbers)
Example: For 8 bits with 4 integer bits, the range is -8 to 7.9375.
Disadvantages of Fixed-Point Representation?
Limited Range: Can’t represent very large or very small numbers.
Less Flexibility: Precision is fixed for the fractional part, so it’s not good for a wide dynamic range.
What is Floating-Point Representation?
Definition: A method to represent real numbers using scientific notation. It has two parts: mantissa (significant digits) and exponent (scaling factor), allowing for a wide range of numbers
Structure of Floating-Point Numbers?
IEEE 754 Standard:
* Single Precision (32-bit): 1 bit for sign, 8 bits for exponent, and 23 bits for mantissa.
* Double Precision (64-bit): 1 bit for sign, 11 bits for exponent, and 52 bits for mantissa.
What is the Exponent Bias in Floating-Point?
*Exponent Bias: The exponent is stored with a bias. In single precision, the bias is 127. This allows both positive and negative exponents to be represented.
* Formula: Actual exponent = stored exponent - bias.
What is Normalization in Floating-Point?
- Normalization: A technique where the mantissa is adjusted so that it falls within a specific range, typically between 1 and 2 (in binary). This allows the most efficient use of available bits.
- Example: 0.0000011 becomes 1.1 × 2^-6
Range of Floating-Point Numbers?
- Single Precision: The range is approximately 1.4 × 10^-45 to 3.4 × 10^38.
- Double Precision: The range is approximately 5.0 × 10^-324 to 1.8 × 10^308.
. What is Underflow in Floating-Point?
Underflow happens when a number is too small to be represented in normal form, so it’s stored as zero or a very small denormalized number.
What is Overflow in Floating-Point?
Overflow occurs when a number exceeds the maximum representable value and results in a special value like infinity.
Disadvantages of Floating-Point Representation?
- Slower: Floating-point arithmetic is more complex and slower than fixed-point.
- More Memory: Requires more bits to store (32-bit or 64-bit).