Introduction

Floating-point addition and multiplication operate on IEEE encodings by aligning exponents, combining significands, normalizing, and rounding. Hardware implementations (add pipelines, fused multiply-add) belong more to Computer Organization; this note stays with the arithmetic rules.

GATE asks for the step sequence, the result of a small addition or multiplication in a given format (including the rounding and any renormalization), the biased-exponent arithmetic in a multiply, the special-case results involving zeros, infinities and NaNs, and examples of non-associativity, absorption and cancellation.

Prerequisites

Core concepts

Addition / subtraction outline

For two normals with exponents e1≥e2e_1\ge e_2 and significands m1,m2m_1,m_2 (including hidden bits):

  1. Align: right-shift m2m_2 by e1−e2e_1-e_2 bits (bits shifted out enter the sticky/guard pipeline).
  2. Add/sub significands according to effective signs.
  3. Normalize: shift the significand sum so it fits 1.f1.f (or handle zero/subnormal), adjusting the exponent.
  4. Round to the target fraction width.
  5. Check overflow (→±∞\to\pm\infty) or underflow (subnormal or zero).
Flowchart of floating-point addition: align exponents, add or subtract significands, normalize, round, then check for overflow or underflow.
Figure 1. Floating-point addition pipeline: align, add, normalize, round, range check.

Two normalization cases arise. After exponent alignment, a same-sign significand sum lies in [1,4)[1,4); when the exponents are equal it lies in [2,4)[2,4), so at most one right shift (exponent +1+1). A subtraction can cancel many leading bits, needing several left shifts (exponent decreases by the shift count). Rounding can also carry out of the significand (1.111⋯11.111\cdots1 rounding up to 10.000⋯010.000\cdots0) and force one more right shift.

Multiplication outline

  1. XOR signs; add unbiased exponents; multiply significands (including hidden bits).
  2. Normalize the product significand; adjust exponent.
  3. Round; handle overflow/underflow and specials.

Biased exponents. With stored fields E1E_1 and E2E_2, the product's field is E1+E2−biasE_1 + E_2 - \textit{bias} before normalization: adding the fields counts the bias twice. The significand product of two values in [1,2)[1, 2) lies in [1,4)[1, 4), so normalization needs at most one right shift. Division subtracts the fields and adds the bias back: E1−E2+biasE_1 - E_2 + \textit{bias}.

Related material. Implementations keep extra bits during alignment so that rounding matches infinite-precision round-to-nearest even. The guard bit is the first bit below the kept LSB, the round bit the next, and the sticky bit is the OR of everything below that. Three bits suffice: the guard bit says whether the discarded part is at least half an ulp, and round and sticky together say whether it is exactly half or more.

Rounding modes (names)

IEEE 754 requires round-to-nearest-ties-to-even as default, plus directed modes (toward +∞+\infty, toward −∞-\infty, toward zero). This note assumes round-to-nearest unless stated. Under ties-to-even, a value exactly halfway between two neighbours goes to the one whose last kept bit is 0.

Every basic operation (+,−,×,÷, +, -, \times, \div, \sqrt{\ }) is correctly rounded: the result equals the exact real result rounded once in the current mode. In round-to-nearest the error is at most half an ulp, a relative error of at most 2−242^{-24} for binary32 and 2−532^{-53} for binary64 only for a nonzero exact result in the normal range without underflow or overflow. For gradual underflow, use an absolute bound of half the minimum subnormal spacing: 2−1502^{-150} for binary32 and 2−10752^{-1075} for binary64. Relative-error ratios exclude exact zero and special results.

Special-case arithmetic (exam facts)

OperationResult idea
∞+∞\infty + \infty (same sign)∞\infty
∞−∞\infty - \inftyNaN (invalid)
0×∞0 \times \inftyNaN
∞/∞\infty / \infty, 0/00/0NaN
finite nonzero / signed zerosigned infinity; result sign is the XOR of operand signs
NaN op xNaN

Signed zeros follow sign rules: (+0)+(−0)=+0(+0) + (-0) = +0 in round-to-nearest (it is −0-0 only when rounding toward −∞-\infty), and (−0)×5=−0(-0) \times 5 = -0. Where a question gives its own table, use it.

How it works

Tiny worked add (decimal scientific, same algorithm)

Add 1.00×1021.00\times 10^{2} and 3.00×1003.00\times 10^{0}: align to 1.00×102+0.03×102=1.03×1021.00\times 10^{2} + 0.03\times 10^{2} = 1.03\times 10^{2}. Already normalized; no round needed.

Binary example: 1.0⋅23+1.0⋅21=10002+00102=10102=1.010⋅231.0\cdot 2^{3} + 1.0\cdot 2^{1} = 1000_2 + 0010_2 = 1010_2 = 1.010\cdot 2^{3} after interpreting with a 4-bit significand toy format.

Rounding with guard, round and sticky

Keep 3 fraction bits. The exact significand 1.000 10011.000\,1001 has kept part 1.0001.000, guard 1, round 0, sticky 1 (from the final 1). Guard 1 with a nonzero round or sticky means more than half an ulp, so round up to 1.0011.001. A design that dropped the sticky bit would see guard 1, round 0 and treat it as an exact tie, then round to even and return 1.0001.000, which is wrong.

Cancellation

Subtracting nearly equal values cancels leading significand bits and can strip precision (catastrophic cancellation). The result is exact for the rounded inputs but may have few meaningful digits relative to the original problem.

Absorption

For a finite xx with finite representable neighbours x−<x<x+x_-<x<x_+, the exact sum rounds to xx when it lies strictly between (x−+x)/2(x_-+x)/2 and (x+x+)/2(x+x_+)/2; at a midpoint, apply ties-to-even. Neighbour spacing can differ across a binade boundary, so an undirected half-ulp rule is unsafe. In binary32 the ulp at 2242^{24} is 2, so 224+1=2242^{24} + 1 = 2^{24}.

Algorithms and pseudocode

Values are decoded to (sign, exponent, significand); ulp refers to the target format. FP-MUL is a finite, nonzero, normal-input outline, not a complete IEEE implementation. Before entering it, handle NaNs (including signalling/invalid behaviour as required), 0×∞0\times\infty as invalid NaN, other infinity products as signed infinity, and finite zero products as signed zero, with the XOR sign. Subnormal inputs are outside this outline; an extension must decode them with effective exponent 1−bias1-\textit{bias} and normalize their 0.f0.f significands, not use E−biasE-\textit{bias} at E=0E=0. Subnormal outputs below are rounded directly from the exact product, avoiding double rounding.

Text
FP-ADD(x, y)                          // conceptual; ignores hardware NaN payloads
1  if either is NaN then return NaN
2  if either is infinity then handle inf rules; return
3  swap x and y so that |x| >= |y| (compare exponents, then significands); the result sign is sign(x)
4  align significand of y by right shifts
5  if same sign then s <- mx + my else s <- mx - my
6  if s = 0 then return signed zero per rules
7  normalize s and adjust exponent
8  round s to fraction width
9  if s = 2 then s <- 1; exponent <- exponent + 1   // rounding carry
10 if exponent too large then return infinity
11 if exponent too small then return subnormal or zero
12 return pack(sign, exponent, fraction)

FP-MUL-NORMAL-INPUTS(x, y)              // specials dispatched first; p fraction bits
1  s <- sign(x) XOR sign(y)
2  E <- E(x) + E(y) - bias
3  m <- m(x) * m(y)                     // exact product in [1, 4)
4  if m >= 2 then m <- m / 2; E <- E + 1
5  if E <= 0 then
6      k <- nearest integer to m * 2^(E + p - 1), ties to even
7      if k = 0 then return signed zero with sign s
8      if k = 2^p then return pack(s, 1, 0) // smallest normal
9      return pack(s, 0, k)            // subnormal fraction field
10 m <- ROUND-NEAREST-EVEN(m, p)
11 if m = 2 then m <- 1; E <- E + 1
12 if E >= all-ones then return signed infinity with sign s
13 return pack(s, E, (m - 1) * 2^p)

ROUND-NEAREST-EVEN(m, p)                // m exact, keep p fraction bits
1  q <- floor(m * 2^p);  r <- m * 2^p - q
2  if r > 1/2 or (r = 1/2 and q is odd) then q <- q + 1
3  return q / 2^p

FP-ADD's alignment shift can be capped at p+3p + 3 positions: anything further only affects the sticky bit. FP-MUL multiplies two (p+1)(p+1)-bit significands, a 2p+22p + 2-bit product before rounding.

Cost model. Fix the target format (both fraction and exponent widths), and use a constant number of sufficiently wide fixed-size registers for its operands, product and guard/round/sticky information. Assume constant-time field tests, bounded-width arithmetic, multiplication, shifts and packing; ROUND-NEAREST-EVEN receives only the bounded intermediate values of these outlines, not an unrestricted exact real. Alignment/normalization work is bounded by the fixed format. FP-ADD, FP-MUL-NORMAL-INPUTS and ROUND-NEAREST-EVEN then take Θ(1)\Theta(1) time and O(1)O(1) auxiliary fixed-size registers in best, average and worst cases, excluding fixed-size inputs/output. No variable-precision bit bound or hardware gate-delay bound follows from this unit-cost classification.

Mathematical explanation

Floating addition is not associative: (a+b)+c(a+b)+c may differ from a+(b+c)a+(b+c) after rounding. Multiplication distributes over addition only approximately. Error analysis uses ulps; a single correctly rounded basic operation errs by at most 0.5 ulp in round-to-nearest.

Model of one operation. For ∘∈{+,−,×,÷}\circ \in \{+, -, \times, \div\} without overflow or underflow, fl(a∘b)=(a∘b)(1+δ)\mathrm{fl}(a \circ b) = (a \circ b)(1 + \delta) with ∣δ∣≤u|\delta| \le u, where the unit roundoff uu is 2−242^{-24} (binary32) or 2−532^{-53} (binary64). Two operations in sequence can each contribute an error, and the errors depend on the order, which is why the order of a sum matters.

Exact cases. Multiplying by a power of two is exact (barring overflow or underflow), because only the exponent changes. The difference of two values within a factor of 2 of each other is exact (Sterbenz's lemma, Related material): cancellation exposes earlier errors but adds none itself.

Worked examples

Example 1: align and add

Toy format with 1 hidden bit and 3 fraction bits: x=1.000⋅25=32x=1.000\cdot 2^{5} = 32, y=1.100⋅22=6y=1.100\cdot 2^{2} = 6. Shift yy right by 3: 0.0011⋅250.0011\cdot 2^{5}. The exact sum is 1.0011⋅25=381.0011 \cdot 2^5 = 38. Keeping 3 fraction bits, the discarded part is exactly half an ulp (guard 1, nothing below), a tie. The kept LSB of 1.0011.001 is 1 (odd), so round to even gives 1.010⋅25=401.010 \cdot 2^5 = 40. The neighbours were 36 and 40, both at distance 2.

Example 2: multiply exponents

binary32: multiply 2.02.0 (0x40000000) by 0.50.5 (0x3F000000) yields 1.01.0 (0x3F800000). Unbiased exponents 1+(−1)=01 + (-1) = 0; significands 1⋅1=11\cdot 1=1. In fields: 128+126−127=127128 + 126 - 127 = 127.

Example 3: overflow to inf

A binary32 multiply that produces exponent above 127 packs to ±∞\pm\infty with the XOR sign. For 2100×21002^{100} \times 2^{100}: fields 227+227−127=327>254227 + 227 - 127 = 327 > 254, so the result is +∞+\infty.

Example 4: specials

∞−∞\infty-\infty is NaN; 1/01/0 is ∞\infty; 0/00/0 is NaN; 0×∞0 \times \infty is NaN; ∞+5=∞\infty + 5 = \infty.

Example 5: multiply with normalization

1.5×1.51.5 \times 1.5 in binary32 (0x3FC00000 twice). Fields 127+127−127=127127 + 127 - 127 = 127; significands 1.12×1.12=10.0121.1_2 \times 1.1_2 = 10.01_2. Normalize: 1.0012×211.001_2 \times 2^1, field 128. Result 2.252.25 = 0x40100000. By contrast 1.5×2.51.5 \times 2.5: 1.12×1.012=1.11121.1_2 \times 1.01_2 = 1.111_2, no shift, field 127+128−127=128127 + 128 - 127 = 128, result 3.753.75 = 0x40700000.

Example 6: rounding that renormalizes

Toy format with 3 fraction bits: x=1.101×24=26x = 1.101 \times 2^4 = 26, y=1.010×22=5y = 1.010 \times 2^2 = 5. Align: y=0.01010×24y = 0.01010 \times 2^4. Sum 1.11110×24=311.11110 \times 2^4 = 31. Rounding to 3 fraction bits: kept 1.1111.111, discarded 1010, an exact tie with an odd LSB, so round up to 10.000×2410.000 \times 2^4. FP-ADD step 9 renormalizes the rounded significand: s=10.0002=2s=10.000_2=2 becomes s=1.0002s=1.000_2, and the exponent increments from 4 to 5. Pack 1.000×25=321.000\times2^5=32; rounding without that exponent increment would be wrong.

Example 7: subtraction with cancellation

Toy format: 1.000×21−1.111×201.000 \times 2^1 - 1.111 \times 2^0. Align: 1.000−0.1111=0.00011.000 - 0.1111 = 0.0001 at exponent 1. Normalize with 4 left shifts: 1.000×2−3=0.1251.000 \times 2^{-3} = 0.125. The result is exact (2−1.8752 - 1.875), but three of its four significand bits are zeros created by the shift, not information.

Example 8: non-associativity in binary32

Let a=108a = 10^8, b=−108b = -10^8, c=1c = 1 (all exact in binary32; the ulp at 10810^8 is 8). Then (a+b)+c=0+1=1(a + b) + c = 0 + 1 = 1, but a+(b+c)=108+(−108)=0a + (b + c) = 10^8 + (-10^8) = 0, because b+c=−99,999,999b + c = -99{,}999{,}999 rounds back to −108-10^8. In binary64, 0.1+0.2≠0.30.1 + 0.2 \ne 0.3: the sum is 0.300000000000000040.30000000000000004.

Example 9: rounding modes

Round the toy value 1.001121.0011_2 (exact 1.18751.1875) to 3 fraction bits. Nearest-even gives 1.0101.010 (1.25), toward zero and toward −∞-\infty give 1.0011.001 (1.125), toward +∞+\infty gives 1.0101.010. For −1.00112-1.0011_2, toward −∞-\infty gives −1.010-1.010 and toward +∞+\infty gives −1.001-1.001.

Important properties and observations

  • Exact powers of two within range multiply/divide by shifting exponents when significands are 1.0.
  • Adding a tiny value to a huge one may leave the huge one unchanged after alignment shifts past the sticky window (absorption).
  • FMA (fused multiply-add) computes a⋅b+ca\cdot b+c with one rounding; Related material for architecture courses.
  • Addition and multiplication are commutative in IEEE arithmetic; only associativity and distributivity fail.
  • Summing many terms smallest first usually loses less accuracy than largest first.

Common misconceptions.

  • "Float add is associative." False.
  • "Underflow always becomes zero." Subnormals provide gradual underflow first.
  • "Infinity is a NaN." Infinity has zero fraction; NaN has nonzero fraction.
  • "Add the exponent fields in a multiply." Subtract the bias once: E1+E2−biasE_1 + E_2 - \textit{bias}.
  • "Rounding never changes the exponent." Rounding 1.11⋯11.11\cdots1 up carries into a new binade.
  • "A guard bit alone gives correct rounding." The sticky bit is needed to tell an exact tie from more than half.

GATE examination perspective

  • STEP ORDER. Align, add, normalize, round.
  • SMALL FORMATS. Do the arithmetic in the stem's format, apply ties-to-even, and renormalize if rounding carries out.
  • SPECIAL CASES. Inf and NaN tables.
  • CANCELLATION. Precision loss when subtracting close values.
  • EXPONENT BIAS. Add true exponents, not raw fields, then re-bias when packing.
  • ASSOCIATIVITY. Construct or recognise an absorption counterexample.

Summary

Sources

  1. MathWorks Fixed-Point Designer, Floating-Point Numbers, (consulted 2026-11-11): operations that produce NaN (∞ - ∞, 0 × ∞, 0/0, ∞/∞), Inf arithmetic, gradual underflow.
  2. P. Zimmermann, Floating-Point Training Module 1: The IEEE 754 Standard, (consulted 2026-11-11): the four rounding modes with ties-to-even as default, correct rounding of +, -, ×, ÷, √, the ties example around 1 in binary32, and (+0) + (-0).

Next steps