Skip to main content

1.2 IEEE-754 Single Precision Standard & Special Value Encodings

📚Module 01: Data Representation & Floating-Point StandardsTopic 1.2⏱️16 min read
🎯High-Yield For:University Semester Exams • Hardware Engineering Rounds • Systems & Compiler Design

💡 Core Intuition: The International Currency Exchange Standard​

Imagine traveling across five countries where each country uses a completely different physical currency, varying wildly in coin sizes, fractional divisions, and non-standard banking ledgers.

🍳 The Everyday Analogy: The Universal Standard Adapter​

  • Pre-Standard Hardware Fragmentation: Prior to 1985, computer hardware was an engineering tower of Babel. IBM mainframes used base-16 floating-point formats, Cray supercomputers used proprietary word widths with no gradual underflow, DEC VAX used distinct D-floating and G-floating representations, and Intel designed early 8087 coprocessors. A scientific physics simulation computing aerospace trajectories would yield divergent orbital paths simply by being recompiled on a different manufacturer's CPU.
  • The IEEE-754 Treaty: In 1985, the Institute of Electrical and Electronics Engineers ratified the IEEE-754 Standard for Floating-Point Arithmetic. It established a universal, mathematically rigorous specification governing bit layouts, biased exponent formulas, rounding protocols, and standardized exception handling. For the first time in computing history, a floating-point calculation produced bit-for-bit identical results on every certified processor across the globe.

💻 Bridging to Computer Science​

The cornerstone of modern computer architecture is the 32-Bit Single Precision Format (formally designated as binary32).

Every 32-bit floating-point word is partitioned into three precisely defined bit fields:

Total Word Length N=1 (Sign)+8 (Exponent)+23 (Mantissa)=32 Bits\text{Total Word Length } N = 1 \text{ (Sign)} + 8 \text{ (Exponent)} + 23 \text{ (Mantissa)} = 32 \text{ Bits}

By defining a hardware bias of 127127, the standard balances positive and negative powers of two while reserving critical boundary bit patterns for exceptional mathematical states: Signed Zeros (+0,−0+0, -0), Infinities (+∞,−∞+\infty, -\infty), Subnormal Numbers, and NaNs (Not a Number).



🏛️ IEEE-754 32-Bit Single Precision Architecture​

In IEEE-754 Single Precision (binary32), a 32-bit memory word is allocated as follows:

  1. Sign Bit (SS, 1 Bit — Bit 31):
    • S=0  ⟹  Positive NumberS = 0 \implies \text{Positive Number}
    • S=1  ⟹  Negative NumberS = 1 \implies \text{Negative Number}
  2. Biased Exponent Field (EE, 8 Bits — Bits 30..23):
    • Encodes the power of two scaling factor.
    • Total combinations: 28=2562^8 = 256 states (ranging from 000000002=000000000_2 = 0 to 111111112=25511111111_2 = 255).
    • Standard Bias: Bias=2k−1−1=28−1−1=128−1=127\text{Bias} = 2^{k-1} - 1 = 2^{8-1} - 1 = 128 - 1 = 127
    • True Exponent calculation: e=E−127e = E - 127
  3. Mantissa / Fraction Field (MM, 23 Bits — Bits 22..0):
    • Encodes the fractional digits to the right of the binary point.
    • Employs Implicit Normalization: The leading bit before the binary point is assumed to be 1 and is omitted from storage.
    • Mathematical Significand: Significand=(1.M)2=1+∑i=123b23−i⋅2−i\text{Significand} = (1.M)_2 = 1 + \sum_{i=1}^{23} b_{23-i} \cdot 2^{-i}
    • Effective Precision: 23 physical bits+1 hidden bit=24 bits of precision23 \text{ physical bits} + 1 \text{ hidden bit} = \mathbf{24 \text{ bits of precision}} (equivalent to ≈7.22\approx 7.22 decimal digits).
IEEE-754 / ISO/IEC 60559Total Frame: 4 Bytes (32 Bits)

IEEE-754 Single Precision (32-Bit binary32) Word Format

Standard Hardware Word Layout: 1 Sign Bit, 8 Biased Exponent Bits, 23 Mantissa Fraction Bits

Sign (S)
1 Bit Bit 31 (MSB)
Exponent (E)
8 Bits Bits 30..23
Fraction (M)
23 Bits Bits 22..0
1 Bit Bit 31 (MSB)Sign (S)

0 for positive values, 1 for negative values. Follows sign-magnitude symmetry.


🎛️ The 5-Case Special Value Encoding Matrix​

A central triumph of the IEEE-754 architecture is that it provides a total mathematical function: no legal bit pattern crashes the hardware.

The 8-bit exponent field partitions the numerical space into 5 distinct hardware cases:

CaseSign (SS)Biased Exponent (EE)Fraction (MM)Mathematical Value / IdentityArchitectural Significance
1. Signed Zero00 or 1100000000200000000_2 (E=0E = 0)000…0002000\dots 000_2 (M=0M = 0)±0.0\pm 0.0Distinguishes +0+0 from −0-0 for directional branch limits.
2. Subnormal Numbers00 or 1100000000200000000_2 (E=0E = 0)Non-Zero (M≠0M \ne 0)(−1)S×(0.M)2×2−126(-1)^S \times (0.M)_2 \times 2^{-126}Gradual Underflow: fills the gap between 00 and smallest normalized number.
3. Normalized Numbers00 or 111≤E≤2541 \le E \le 254Any Bit Pattern(−1)S×(1.M)2×2E−127(-1)^S \times (1.M)_2 \times 2^{E - 127}Standard general computing range (e∈[−126,+127]e \in [-126, +127]).
4. Signed Infinity00 or 1111111111211111111_2 (E=255E = 255)000…0002000\dots 000_2 (M=0M = 0)±∞\pm \inftySaturated overflow (e.g. division of non-zero by zero: 1.0/0.01.0 / 0.0).
5. Not a Number (NaN)00 or 1111111111211111111_2 (E=255E = 255)Non-Zero (M≠0M \ne 0)NaN\text{NaN}Invalid operations (e.g. 0.0/0.00.0/0.0, ∞−∞\infty - \infty, −1\sqrt{-1}).

🔬 In-Depth Analysis of Special Cases​

1. The Signed Zeros (+0+0 and −0-0)​

Why does IEEE-754 maintain two distinct zeros?

  • Both +0+0 and −0-0 compare as equal in standard comparisons (+0.0 == -0.0 evaluates to true).
  • However, in calculus and complex analysis, sign continuity is essential: 1.0+0.0=+∞whereas1.0−0.0=−∞\frac{1.0}{+0.0} = +\infty \qquad\text{whereas}\qquad \frac{1.0}{-0.0} = -\infty
  • Signed zero preserves sign information across continuous functions, such as branch cuts in complex logarithms and square roots.

2. Subnormal (Denormalized) Numbers & Gradual Underflow​

In architectures without subnormals, if a calculation resulted in a number smaller than the minimum normalized value (2−1262^{-126}), it immediately snapped to zero (abrupt underflow). This created a dangerous "underflow hazard" where x−y=0x - y = 0 could occur even when x≠yx \ne y.

IEEE-754 solves this via Subnormal Numbers:

  • When E=0E = 0 and M≠0M \ne 0, the hidden bit becomes 00 instead of 11!
  • Fixed Exponent: The exponent is frozen at −126-126 (NOT −127-127): V=(−1)S×(0.M)2×2−126V = (-1)^S \times (0.M)_2 \times 2^{-126}
  • As numbers shrink toward zero, precision degrades gradually (losing leading bits one by one) rather than abruptly collapsing to zero.
  • The absolute smallest positive representable non-zero number is when M=000…0012=2−23M = 000\dots 001_2 = 2^{-23}: Nmin⁡-subnormal=2−23×2−126=2−149≈1.401298×10−45N_{\min\text{-subnormal}} = 2^{-23} \times 2^{-126} = 2^{-149} \approx 1.401298 \times 10^{-45}

3. Not a Number (NaN): Signaling vs. Quiet​

When E=255E = 255 and M≠0M \ne 0, the word represents a NaN:

  • Quiet NaN (QNaN): The most significant bit of the mantissa is 1 (b22=1b_{22} = 1). It propagates quietly through subsequent operations without raising a hardware trap (e.g., NaN + 5 = NaN).
  • Signaling NaN (SNaN): The most significant bit of the mantissa is 0 with at least one remaining non-zero bit (b22=0,M≠0b_{22} = 0, M \ne 0). It immediately triggers a CPU hardware exception trap, ideal for catching uninitialized memory variables.

🔄 Bidirectional Conversion Algorithms​

Algorithm 1: Decimal to IEEE-754 32-Bit Hexadecimal​

To convert any decimal real number DD into its 32-bit IEEE-754 hex representation:

  1. Determine Sign Bit (SS): If D≥0  ⟹  S=0D \ge 0 \implies S = 0; if D<0  ⟹  S=1D < 0 \implies S = 1. Take the absolute magnitude ∣D∣|D|.
  2. Convert to Pure Binary: Convert the integer component via successive division by 2, and the fractional component via successive multiplication by 2.
  3. Normalize to 1.M×2e1.M \times 2^e: Shift the radix point so exactly one 1 sits to the left. The shift count yields the true exponent ee.
  4. Compute Biased Exponent (EE): E=e+127E = e + 127 Express EE as an 8-bit unsigned binary integer.
  5. Extract Mantissa (MM): Extract the 23 bits immediately following the radix point. If shorter than 23 bits, pad with trailing zeros.
  6. Assemble and Pack: Concatenate [S]1 [E]8 [M]23[S]_{1} \ [E]_{8} \ [M]_{23} into 32 bits, partition into 8 nibbles (4 bits each), and translate to hexadecimal.

Algorithm 2: IEEE-754 32-Bit Hexadecimal to Decimal​

To decode an 8-character hexadecimal word HH back to its decimal real value:

  1. Unpack Hexadecimal to 32 Binary Bits: Convert each hex digit into a 4-bit nibble.
  2. Decompose Fields:
    • Bit 31: Sign bit SS.
    • Bits 30..23: Biased exponent EE.
    • Bits 22..0: Mantissa fraction MM.
  3. Inspect for Special Cases:
    • If E=0E = 0 and M=0  ⟹  Value=±0.0M = 0 \implies \text{Value} = \pm 0.0.
    • If E=0E = 0 and M≠0  ⟹  Value=(−1)S×(0.M)2×2−126M \ne 0 \implies \text{Value} = (-1)^S \times (0.M)_2 \times 2^{-126}.
    • If E=255E = 255 and M=0  ⟹  Value=±∞M = 0 \implies \text{Value} = \pm \infty.
    • If E=255E = 255 and M≠0  ⟹  Value=NaNM \ne 0 \implies \text{Value} = \text{NaN}.
  4. Compute Normalized Decimal Value (1≤E≤2541 \le E \le 254):
    • True exponent: e=E−127e = E - 127.
    • Fractional value: 1.M=1+∑i=123b23−i⋅2−i1.M = 1 + \sum_{i=1}^{23} b_{23-i} \cdot 2^{-i}.
    • Final magnitude: V=(−1)S×(1.M)×2eV = (-1)^S \times (1.M) \times 2^e.

You can verify binary and hexadecimal machine words interactively below:

💾

Interactive IEEE-754 Single Precision 32-Bit Inspector

Type any decimal number or click individual register bits to see live IEEE-754 encoding, field breakdown, and special values

Computer Architecture 1.x
Interactive 32-Bit Register (Click any bit to flip it!):MSB [31] ➔ LSB [0]
131
130
029
028
027
026
025
124
023
122
021
120
119
018
117
016
015
014
013
012
011
010
09
08
07
06
05
04
03
02
01
00
Sign (1 Bit: [31]) = - (Negative)
Biased Exponent (8 Bits: [30..23]) = 130
Mantissa Fraction (23 Bits: [22..0])
1. Sign Component (S)
(-1)1 = -1
2. True Exponent (E - Bias)
2(130 - 127) = 23
Bias = 127 (Single Precision)
3. Significand / Mantissa (M)
1.703125
Normalized (Hidden bit is 1)
Full Reconstructed IEEE-754 Formula
(-) 1.7031250 × 23 = -13.625

📏 Dynamic Range & Quantization Boundaries in Single Precision​

📐Single Precision Boundary Mathematical Spectrumformula
Normalized Positive Range: [2−126, (2−2−23)×2127]≈[1.175494×10−38, 3.402823×1038]\text{Normalized Positive Range: } \left[2^{-126}, \ (2 - 2^{-23}) \times 2^{127}\right] \approx [1.175494 \times 10^{-38}, \ 3.402823 \times 10^{38}]Subnormal Positive Range: [2−149, (1−2−23)×2−126]≈[1.401298×10−45, 1.175494×10−38)\text{Subnormal Positive Range: } \left[2^{-149}, \ (1 - 2^{-23}) \times 2^{-126}\right] \approx [1.401298 \times 10^{-45}, \ 1.175494 \times 10^{-38})
  • Maximum Normalized Positive Value (Nmax⁡N_{\max}):
    • S=0S = 0, E=254  ⟹  e=254−127=127E = 254 \implies e = 254 - 127 = 127.
    • M=111…1112  ⟹  1.M=2−2−23M = 111\dots 111_2 \implies 1.M = 2 - 2^{-23}.
    • Nmax⁡=(2−2−23)×2127=2128−2104≈3.4028235×1038N_{\max} = (2 - 2^{-23}) \times 2^{127} = 2^{128} - 2^{104} \approx 3.4028235 \times 10^{38}.
  • Minimum Normalized Positive Value (Nmin⁡-normN_{\min\text{-norm}}):
    • S=0S = 0, E=1  ⟹  e=1−127=−126E = 1 \implies e = 1 - 127 = -126.
    • M=000…0002  ⟹  1.M=1.0M = 000\dots 000_2 \implies 1.M = 1.0.
    • Nmin⁡-norm=1.0×2−126≈1.1754944×10−38N_{\min\text{-norm}} = 1.0 \times 2^{-126} \approx 1.1754944 \times 10^{-38}.

🏭 Real-World Production Context: The Ariane 5 Flight 501 Disaster & Linux Kernel Subnormals​

In mission-critical software and high-scale systems, subtle misunderstandings of IEEE-754 semantics have caused catastrophic physical and financial failures.

1. The Ariane 5 Rocket Explosion (1996)​

On June 4, 1996, the European Space Agency's maiden Ariane 5 rocket veered abruptly off course and exploded just 37 seconds after liftoff, resulting in a $370 million hardware loss.

  • Root Cause: The inertial reference computer software (reused from Ariane 4 without re-verification) converted a 64-bit floating-point horizontal bias velocity variable into a 16-bit signed integer.
  • The Arithmetic Failure: The higher horizontal velocity of Ariane 5 exceeded 32,76732,767 (the maximum representable 16-bit signed integer). The Ada conversion code threw an unhandled hardware operand exception.
  • Cascading Crash: Both the primary and backup flight computers shut down simultaneously. The rocket's steering nozzles swiveled to full deflection, triggering aerodynamic breakup and automated self-destruction.

2. The 100x CPU Slowdown: Subnormals in Audio DSP & Gaming​

While subnormals provide graceful underflow in mathematics, they are notoriously difficult to implement in hardware:

  • In older Intel Pentium and ARM cores, ALUs lacked dedicated silicon paths for subnormals. Whenever an operation produced a subnormal number, the hardware triggered an internal microcode trap, routing the calculation to slow software emulation.
  • The Production Bug: In digital audio workstations (DAWs) and video game physics engines, decaying audio reverb filters and friction calculations naturally decay toward zero. When values entered the subnormal range (<10−38< 10^{-38}), CPU usage suddenly spiked from 2%2\% to 100%100\%, causing severe audio dropouts and game frame stutters!
  • The Production Solution: Modern compiler flags (-ffast-math) and hardware status registers allow developers to configure the FPU into FTZ (Flush-To-Zero) and DAZ (Denormals-Are-Zero) modes. Subnormals are instantly clamped to zero in a single cycle, trading microscopic mathematical precision for predictable real-time execution throughput.

📐 Numerical Applications & Worked Examples​

The following worked engineering problems demonstrate step-by-step IEEE-754 single precision bit encoding, hexadecimal conversions, and boundary evaluation algorithms.

Example 1: Decimal to IEEE-754 Single Precision Hexadecimal​

Problem Statement:
Encode the decimal number +85.125+85.125 into standard IEEE-754 32-bit single precision floating-point format. Express the final result as a 32-bit binary string and its corresponding 8-digit hexadecimal machine word.

Step-by-Step Solution:

  1. Determine Sign Bit (SS):
    The number +85.125+85.125 is positive   ⟹  S=0\implies S = 0.

  2. Convert Integer and Fractional Parts to Binary:

    • Integer part: 8510=64+16+4+1=(1010101)285_{10} = 64 + 16 + 4 + 1 = (1010101)_2.
    • Fractional part: 0.12510=18=2−3=(0.001)20.125_{10} = \frac{1}{8} = 2^{-3} = (0.001)_2.
    • Combined binary magnitude: (85.125)10=(1010101.001)2(85.125)_{10} = (1010101.001)_2
  3. Normalize to Scientific Form (1.M×2e1.M \times 2^e):
    Shift the binary point 6 positions to the left: (1010101.001)2=1.010101001×26(1010101.001)_2 = 1.010101001 \times 2^6

    • True exponent: e=6e = 6.
    • Fractional mantissa string: 0101010012010101001_2.
  4. Calculate Biased Exponent (EE):

    • Apply IEEE-754 bias (Bias=127\text{Bias} = 127): E=e+127=6+127=13310E = e + 127 = 6 + 127 = 133_{10}
    • Convert 13310133_{10} to 8-bit binary: 133=128+4+1=(10000101)2133 = 128 + 4 + 1 = (10000101)_2
  5. Construct 23-Bit Mantissa Field (MM):

    • Omit the implicit leading 1.
    • Take the fractional tail 010101001010101001 (9 bits) and pad with 14 trailing zeros to fill 23 bits: M=010101001000000000000002M = 01010100100000000000000_2
  6. Assemble the 32-Bit Word & Translate to Hexadecimal:
    [S]1 [E]8 [M]23=0 10000101 010101001000000000000002[S]_1 \ [E]_8 \ [M]_{23} = 0 \ 10000101 \ 01010100100000000000000_2

    Partition into 4-bit nibbles: 0100 0010 1010 1010 0100 0000 0000 000020100 \ 0010 \ 1010 \ 1010 \ 0100 \ 0000 \ 0000 \ 0000_2 Translate to hexadecimal: 0x42AA4000\mathbf{0x42AA4000}


Example 2: Hexadecimal Machine Word to Decimal Value​

Problem Statement:
A 32-bit floating-point register contains the hexadecimal value 0x40400000. Decode this IEEE-754 single precision word back to its exact decimal value.

Step-by-Step Solution:

  1. Unpack Hexadecimal Word into 32 Binary Bits:
    4040000016=0100 0000 0100 0000 0000 0000 0000 00002\text{40400000}_{16} = 0100 \ 0000 \ 0100 \ 0000 \ 0000 \ 0000 \ 0000 \ 0000_2

  2. Partition into IEEE-754 Fields:

    • Sign bit (SS, Bit 31): 0  ⟹  0 \implies Positive number.
    • Biased Exponent (EE, Bits 30..23): E=100000002=12810E = 10000000_2 = 128_{10}
    • Mantissa (MM, Bits 22..0): M=100000000000000000000002M = 10000000000000000000000_2
  3. Compute True Exponent (ee):
    e=E−127=128−127=+1e = E - 127 = 128 - 127 = +1

  4. Compute Significand (1.M1.M):
    Prepend the implicit leading 1: 1.M=(1.10000000000000000000000)2=1+2−1=1+0.5=1.5101.M = (1.10000000000000000000000)_2 = 1 + 2^{-1} = 1 + 0.5 = 1.5_{10}

  5. Calculate Final Decimal Value:
    V=(−1)0×1.5×21=1.5×2=+3.0V = (-1)^0 \times 1.5 \times 2^1 = 1.5 \times 2 = \mathbf{+3.0}


Example 3: Negative Number Binary Bit Pattern Decoding​

Problem Statement:
Decode the following 32-bit binary pattern formatted in IEEE-754 single precision into its decimal equivalent: 1 10000011 10100000000000000000000

Step-by-Step Solution:

  1. Identify Architectural Fields:

    • Sign bit (SS): 1  ⟹  1 \implies Negative number.
    • Biased Exponent (EE): 100000112=128+2+1=1311010000011_2 = 128 + 2 + 1 = 131_{10}.
    • Mantissa (MM): 10100000000000000000000210100000000000000000000_2.
  2. Compute True Exponent (ee):
    Because 1≤E≤2541 \le E \le 254, the number is normalized: e=E−127=131−127=+4e = E - 127 = 131 - 127 = +4

  3. Compute Significand (1.M1.M):
    Prepend the hidden 1: 1.M=(1.101)2=1+2−1+2−3=1+0.5+0.125=1.625101.M = (1.101)_2 = 1 + 2^{-1} + 2^{-3} = 1 + 0.5 + 0.125 = 1.625_{10}

  4. Calculate Final Decimal Value:
    V=(−1)1×1.625×24=−1×1.625×16=−26.0V = (-1)^1 \times 1.625 \times 2^4 = -1 \times 1.625 \times 16 = \mathbf{-26.0}


Example 4: Fractional Decimal +0.5+0.5 and Special Zero Verification​

Problem Statement:

  1. Derive the IEEE-754 single precision bit pattern for the decimal value +0.5+0.5.
  2. Identify the mathematical value represented by the 32-bit word 0x00000000.

Step-by-Step Solution:

  1. Encode Decimal +0.5+0.5:

    • Sign: Positive   ⟹  S=0\implies S = 0.
    • Binary value: 0.510=(0.1)20.5_{10} = (0.1)_2.
    • Normalize to 1.M×2e1.M \times 2^e: (0.1)2=1.0×2−1(0.1)_2 = 1.0 \times 2^{-1}
    • True exponent: e=−1e = -1.
    • Biased exponent: E=−1+127=12610=(01111110)2E = -1 + 127 = 126_{10} = (01111110)_2.
    • Mantissa: Since (1.0)2(1.0)_2 has only zeros after the binary point: M=000000000000000000000002M = 00000000000000000000000_2
    • Assembled binary word: 0 01111110 0000000000000000000000020 \ 01111110 \ 00000000000000000000000_2
    • Grouped hex: 0011 1111 0000 0000 0000 0000 0000 00002=0x3F0000000011 \ 1111 \ 0000 \ 0000 \ 0000 \ 0000 \ 0000 \ 0000_2 = \mathbf{0x3F000000}
    • Result: Fraction bits are all zeros (000…0000\dots 0), and biased exponent is 126126 (true exponent −1-1).
  2. Decode Hex Word 0x00000000:

    • Binary string: 3232 zeros.
    • S=0S = 0, E=000000002=0E = 00000000_2 = 0, M=000…02=0M = 000\dots 0_2 = 0.
    • Referring to the IEEE-754 special encoding table: when E=0E = 0 and M=0M = 0, the word represents the special value +0.0+0.0 (not a normalized power of two!).

🎯 Exam & Interview Pitfall Check​

Core Conceptual Questions
  • Why does IEEE-754 single precision use an exponent bias of 127 instead of 128?
    An 8-bit unsigned integer spans 00 to 255255. If an excess-128 bias were used, the true exponent range would be −128-128 to +127+127, creating an asymmetric bias favoring negative exponents. By choosing Bias=127\text{Bias} = 127, the normal true exponent range spans from −126-126 (when E=1E = 1) to +127+127 (when E=254E = 254), providing exact mathematical symmetry between positive and negative scaling (2−1262^{-126} to 2+1272^{+127}) while cleanly reserving E=0E = 0 and E=255E = 255 for special values.

  • Why do subnormal numbers use an effective exponent of −126-126 instead of −127-127 (0−1270 - 127)?
    If subnormals used e=0−127=−127e = 0 - 127 = -127, the largest subnormal number would be (0.111…1)2×2−127≈2−127(0.111\dots 1)_2 \times 2^{-127} \approx 2^{-127}. However, the smallest normalized number is 1.0×2−126=2×2−1271.0 \times 2^{-126} = 2 \times 2^{-127}. This would leave a factor-of-two gap between normalized and subnormal numbers! By freezing the subnormal exponent at −126-126, the largest subnormal (1−2−23)×2−126(1 - 2^{-23}) \times 2^{-126} sits exactly one ULP below the smallest normalized number 1.0×2−1261.0 \times 2^{-126}, ensuring completely smooth and seamless gradual underflow.

Common Interview Traps
  • Trap: Assuming 0.10.1 can be represented exactly in IEEE-754 floating-point.
    In base 10, 0.10.1 is an exact finite decimal (1/101/10). In base 2, dividing by 10 produces an infinite repeating binary fraction: (0.1)10=(0.00011001100110011… )2(0.1)_{10} = (0.00011001100110011\dots)_2 Because a 32-bit register truncates the mantissa after 23 bits, storing 0.10.1 introduces a microscopic rounding error (≈0.10000000149\approx 0.10000000149). This is why 0.1 + 0.2 == 0.3 famously evaluates to false in systems languages and JavaScript!

  • Trap: Assuming E=255E = 255 always represents Infinity.
    Never assume an exponent of all 1s (E=255E = 255) automatically signifies Infinity. If the mantissa is non-zero (M≠0M \ne 0), the word represents NaN (Not a Number). Only when M=0M = 0 is the word interpreted as Infinity.

  • Trap: Forgetting the Hidden Bit when Decoding Normalized Numbers.
    When unpacking a hex word like 0x40400000, students frequently compute the value as 0.5×21=1.00.5 \times 2^1 = 1.0 by evaluating the mantissa as a pure fraction 0.M0.M. Remember: for normalized numbers (1≤E≤2541 \le E \le 254), the leading bit is implicitly 1, making the significand 1.51.5, which yields +3.0+3.0!


💬

Discussion & Doubts