You may be comfortable converting integers to binary but still lose track of the hidden leading bit, exponent bias and rounding when a floating-point pattern appears. Start at the bit-pattern level: encode -13.25 as binary32, decode 0x3F400000, classify edge cases, then prove ties-to-even at an exact midpoint and non-associativity with binary32 operands. Number systems and base conversions: binary, octal and hexadecimal explained refreshes binary conversion.
IEEE 754 representation: sign, exponent and fraction fields
Start with binary scientific notation:
13.25_10 = 1101.01_2 = 1.10101_2 x 2^3
The value is positive, its significand is 1.10101_2, and its true exponent is 3. A normal IEEE 754 number does not store the leading 1 of the significand. That bit is implicit, so 1.10101_2 contributes fraction bits 10101..., not 110101....
Format | Sign bits | Exponent bits | Fraction bits | Bias |
|---|---|---|---|---|
binary32 | 1 | 8 | 23 | 127 |
binary64 | 1 | 11 | 52 | 1023 |
For a normal value, the formula is (-1)^s x (1.f)_2 x 2^(E-bias). Here E is the unsigned stored exponent. Keep the three exponent quantities separate: E is stored, the bias belongs to the format, and the true exponent is e = E - bias. In the running binary32 example, e = 3, so E = 3 + 127 = 130 = 10000010_2.
IEEE 754 binary32 encoding: work -13.25 to 0xC1540000
Encode the magnitude first. Since 13 = 1101_2 and .25 = .01_2, we get 13.25 = 1101.01_2. Normalising gives 1.10101_2 x 2^3.
Now fill the fields:
The value is negative, so
s = 1.The true exponent is
3, soE = 3 + 127 = 130 = 10000010_2.Remove the implicit leading
1and pad the fraction to 23 bits:10101000000000000000000.
Concatenating without dropping a bit gives 1 | 10000010 | 10101000000000000000000, or 11000001010101000000000000000000_2. Grouping into nibbles gives 1100 0001 0101 0100 0000 0000 0000 0000, hence 0xC1540000.
Reconstruct it as a check:
(-1)^1 x 1.10101_2 x 2^(130-127) = -1.65625 x 8 = -13.25

IEEE 754 decoding: work 0x3F400000 back to 0.75
First expand the hexadecimal word rather than guessing its value:
0x3F400000 = 00111111010000000000000000000000_2
Split it as 0 | 01111110 | 10000000000000000000000. Thus s = 0, E = 01111110_2 = 126, and e = 126 - 127 = -1. Restoring the hidden bit turns .1000..._2 into the normal significand 1.1000..._2 = 1.5_10. Therefore:
(-1)^0 x 1.5 x 2^-1 = 0.75
Use the same decode order every time: split the fields, classify the exponent pattern, unbias only a normal exponent, restore the correct leading bit, then apply the sign and power of two.
IEEE 754 special values: zeros, subnormals, infinities and NaNs
The exponent pattern tells you which formula or classification applies in binary32.
Exponent field | Fraction field | Meaning |
|---|---|---|
| Any | Normal: |
| Nonzero | Subnormal: |
| Zero |
|
| Zero |
|
| Nonzero | NaN |
For example, 0x7F800000 is +infinity, 0xFF800000 is -infinity, and 0x7FC00000 is one NaN pattern. NaN is unordered, and even NaN == NaN is false. Software therefore needs an appropriate NaN test.
Subnormals fill the gap near zero without an implicit leading 1. The smallest positive normal binary32 value is 2^-126, approximately 1.17549435 x 10^-38. The smallest positive subnormal is 2^-149, approximately 1.40129846 x 10^-45. The largest subnormal is (1 - 2^-23) x 2^-126, immediately below the smallest normal.
IEEE 754 rounding: why 0.1 is approximate and ties go to even
Decimal 0.1 repeats in binary as 0.0001100110011..._2, so no finite binary fraction can store it exactly. In binary32 it becomes 0x3DCCCCCD, whose exact value is 0.100000001490116119384765625, slightly above decimal 0.1.
The default rule is round to nearest, ties to even. Around 1.0, binary32 0x3F800000 is exactly 1.0. The next larger value, 0x3F800001, is 1 + 2^-23 = 1.00000011920928955078125. Their exact midpoint is 1 + 2^-24 = 1.000000059604644775390625. It is an exact tie, and 1.0 has an even final stored fraction bit, so ties-to-even selects 1.0.
The gap 2^-23 here is one unit in the last place, or one ULP. Spacing changes with the exponent, so it is not constant across all magnitudes. IEEE 754 also defines directed modes toward zero, toward positive infinity and toward negative infinity.

Floating-point traps: equality, non-associativity, overflow and underflow
Floating-point addition is not associative. In binary32, let a = 16777216 = 2^24, b = 1, and c = -16777216.
For
(a+b)+c, the exacta+b = 16777217is halfway between the representable values16777216and16777218. Ties-to-even rounds it to16777216, so the final result is0.For
a+(b+c), the valueb+c = -16777215is exactly representable. Addingathen gives1.
Therefore (a+b)+c != a+(b+c) in floating-point arithmetic, although real-number addition is associative.
Other traps also need deliberate repairs. Compare computed values with a context-appropriate absolute or relative tolerance instead of assuming exact equality with decimal 0.1. Subtracting nearly equal large values can erase leading significant bits, so reformulate or rescale when possible. Test for NaN explicitly rather than using equality.
The largest finite binary32 magnitude is (2 - 2^-23) x 2^127, approximately 3.40282347 x 10^38. A larger-magnitude result overflows under the active rounding rules. A tiny nonzero result below the normal range may become subnormal or round to zero. IEEE 754 names invalid, division by zero, overflow, underflow and inexact as status conditions, but they are not ordinary programming exceptions guaranteed to stop execution.
IEEE 754 exam relevance: conversion, classification and rounding checks
Typical question shapes include encoding a decimal value, decoding a binary or hexadecimal word, classifying all-zero or all-one exponent patterns, comparing normal and subnormal formulas, calculating spacing near a power of two, and tracing rounding or non-associativity.
Use four checks under time pressure:
Mark the sign.
Inspect the exponent pattern before subtracting the bias.
Restore a leading
1only for a normal value.Reconstruct the numerical value before selecting an option.
Your answer checkpoints are -13.25 -> 0xC1540000, 0x3F400000 -> 0.75, and exponent 11111111 with a nonzero fraction means NaN. Practise these patterns inside Computer Organization using the GATE Test Series: Mocks and Topic-wise Tests. For floating-point addition and multiplication, continue with Floating point representation: IEEE 754 format and arithmetic explained.
The short version and the next IEEE 754 step
For a normal number, write binary scientific notation, set the sign, add the bias, omit the hidden leading 1 from the stored fraction, and reconstruct the value to check the bits. Keep the anchors -13.25 -> 0xC1540000 and 0x3F400000 -> 0.75.
Try two more without reading a worked solution: encode +10.5 and verify 0x41280000; decode 0xBF000000 and verify -0.5. Justify every field before checking the hexadecimal answer.
For a structured subject route, use GATE Guidance by Sanchit Sir. You can also use the broader GATE CS Exam Preparation category to choose the course or test route that fits your next step.




