ArticleslgStudy

computer science

Sterbenz lemma

Sterbenz lemma is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Sterbenz lemma rather than just read about it. In short: In floating-point arithmetic, the Sterbenz lemma or Sterbenz's lemma is a theorem giving conditions under which floating-point differences are computed exactly. It is named after Pat Holmes Sterbenz, who published a variant of it in 1974.

Key takeaways

  • Sterbenz lemma belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Sterbenz lemma to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Sterbenz lemma from memory before moving on to harder problems.

Reference excerpt

In floating-point arithmetic, the Sterbenz lemma or Sterbenz's lemma is a theorem giving conditions under which floating-point differences are computed exactly. It is named after Pat Holmes Sterbenz, who published a variant of it in 1974.

The Sterbenz lemma applies to IEEE 754, the most widely used floating-point number system in computers.

Proof Let β {\displaystyle \beta } be the radix of the floating-point system and p {\displaystyle p} the precision. Consider several easy cases first:

If x {\displaystyle x} is zero then x − y = − y {\displaystyle x-y=-y} , and if y {\displaystyle y} is zero then x − y = x {\displaystyle x-y=x} , so the result is trivial because floating-point negation is always exact. If x = y {\displaystyle x=y} the result is zero and thus exact. If x < 0 {\displaystyle x<0} then we must also have y / 2 ≤ x < 0 {\displaystyle y/2\leq x<0} so y < 0 {\displaystyle y<0} . In this case, x − y = − ( − x − − y ) {\displaystyle x-y=-(-x--y)} , so the result follows from the theorem restricted to x , y ≥ 0 {\displaystyle x,y\geq 0} . If x ≤ y {\displaystyle x\leq y} , we can write x − y = − ( y − x ) {\displaystyle x-y=-(y-x)} with x / 2 ≤ y ≤ 2 x {\displaystyle x/2\leq y\leq 2x} , so the result follows from the theorem restricted to x ≥ y {\displaystyle x\geq y} . For the rest of the proof, assume 0 < y < x ≤ 2 y {\displaystyle 0<y<x\leq 2y} without loss of generality. Write x , y > 0 {\displaystyle x,y>0} in terms of their positive integral significands s x , s y ≤ β p − 1 {\displaystyle s_{x},s_{y}\leq \beta ^{p}-1} and minimal exponents e x , e y {\displaystyle e_{x},e_{y}} :

x = s x ⋅ β e x − p + 1 y = s y ⋅ β e y − p + 1 {\displaystyle {\begin{aligned}x&=s_{x}\cdot \beta ^{e_{x}-p+1}\\y&=s_{y}\cdot \beta ^{e_{y}-p+1}\end{aligned}}}

Note that x {\displaystyle x} and y {\displaystyle y} may be subnormal—we do not assume s x , s y ≥ β p − 1 {\displaystyle s_{x},s_{y}\geq \beta ^{p-1}} . The subtraction gives:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Sterbenz lemma

Start with the simplest possible case. Write down what Sterbenz lemma claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Sterbenz lemma before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Sterbenz lemma ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Sterbenz lemma

In research
Sterbenz lemma appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Sterbenz lemma in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Sterbenz lemma is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer arithmetic, Floating point, Numerical analysis, so understanding it makes those chapters shorter.
In everyday life
Look for Sterbenz lemma outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Sterbenz lemma” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Sterbenz lemma in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Sterbenz lemma means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Sterbenz lemma out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Sterbenz lemma in simple terms?

In floating-point arithmetic, the Sterbenz lemma or Sterbenz's lemma is a theorem giving conditions under which floating-point differences are computed exactly. It is named after Pat Holmes Sterbenz, who published a variant of it in 1974.

Why does Sterbenz lemma matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Sterbenz lemma?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Sterbenz lemma.

Tags

  • Computer arithmetic
  • Floating point
  • Numerical analysis

Keep exploring