← Adversarial Mathematics: From First Principles

Exact Numbers and Misleading Aggregates

Why a comparison of fractions should be exact, why floating point and fifty-digit checks are evidence rather than proof, and why an advantage in every group can vanish or reverse when the groups are combined. The arithmetic behind Simpson's paradox, and what it does not say about causes.

Two Part I investigations turn on numbers that have to be exactly right. Euler’s refutation of Fermat is one division: 4294967297 = 641 × 6700417, with no remainder, not a small one. And the kidney-stone reversal in Part I, Chapter 8 rests on comparisons such as 81/87 against 234/270, where the answer must not depend on how many decimals a calculator shows. This chapter is about how to compute so that the answer is exact, and about what the arithmetic of combined groups can and cannot say.

Comparing fractions exactly

For positive denominators b and d,

$$\frac{a}{b} > \frac{c}{d} \iff ad > bc .$$

That turns every comparison of fractions into a comparison of whole numbers, which a computer does without any rounding. The kidney-stone comparisons become:

Comparison Cross-products Result
81/87 against 234/270 81 × 270 = 21870, 234 × 87 = 20358 open surgery higher
192/263 against 55/80 192 × 80 = 15360, 55 × 263 = 14465 open surgery higher
273/350 against 289/350 same denominator percutaneous higher

This is what the Lean and Rocq checks of Chapter 8 — When Every Group Says Yes (Part I, Chapter 7) do, using the rational numbers ℚ, and what the Python cross-check does with its Fraction type. Rational arithmetic is exact: every intermediate result is a fraction in lowest terms, held as two integers of whatever size it needs.

Why floating point is not enough

Ordinary computer arithmetic uses floating point, typically IEEE double precision: about 16 significant decimal digits, held in 53 binary digits. Most decimal fractions cannot be stored exactly. In Python, 0.1 + 0.2 == 0.3 is False, because the sum is stored as 0.30000000000000004.

Every integer up to 2⁵³ = 9007199254740992 can be stored exactly. Beyond that, gaps open up: near 2⁶⁴, consecutive doubles are 4096 apart. The next Fermat number shows what can happen:

$$F_6 = 2^{64} + 1 = 18446744073709551617 .$$

Here is one concrete sequence, in Python, whose float is an IEEE 754 binary64 double. Converting the exact integer with float(2**64 + 1) rounds to the nearest double, which is exactly 2⁶⁴. From then on the program is working with 2⁶⁴, and every later step inherits that. float(2**64 + 1) % 2 gives 0.0, so a parity test on the float says F₆ is even. The same test on the integer, (2**64 + 1) % 2, gives 1. What a program reports depends on where in its sequence of operations the conversion happens; once it has happened, the information that distinguished F₆ from 2⁶⁴ is gone. In exact arithmetic F₆ is odd, and in fact F₆ = 274177 × 67280421310721. Fortuné Landry announced that factorisation in 1880. The rounding error is not small or harmless. It changes the answer to a yes-or-no question.

F₅ = 2³² + 1 is below 2⁵³, so a double holds it exactly. Euler’s division could be done in floating point by luck. The investigation does it in exact integers anyway, so that luck is never needed.

High precision is still not exact

What about computing with 50 digits instead of 16? That makes rounding errors much smaller, but it does not remove them, and it cannot tell an identity from a very near miss. A famous example:

$$e^{\pi\sqrt{163}} = 262537412640768743.99999999999925\ldots$$

At 15 significant digits it looks like 2.62537412640768 × 10¹⁷, with nothing to say whether it is an integer. Even at 30 digits it reads 262537412640768743.999999999999, which looks like 262537412640768744 with rounding noise. It is not an integer. It misses by about 7.5 × 10⁻¹³. (It is so close for a reason in number theory, which is a story for another book.)

This is why Chapter 3 — Continuous Terms, Discontinuous Sum (Part I, Chapter 2) corrected a label. The independent check of the cosine identity there was a 50-digit mpmath calculation, first described as exact SymPy arithmetic. A 50-digit agreement is numerical evidence: strong, useful and worth having. It is not proof that two expressions are equal, and the book does not count it as proof.

The rule this book follows:

  • Exact (integers, rationals, symbolic algebra that reduces to 0, or a kernel proof) can establish an equality or a comparison.
  • Numerical (floating point, any fixed precision) is evidence. It can refute an equality when the difference is far larger than the error bound. It cannot confirm one.

Combined rates are weighted averages

Now the paradox. An arm’s combined success rate is a weighted average of its group rates, weighted by how its own patients are spread across the groups. For open surgery in the kidney-stone data,

$$\frac{273}{350} = \frac{87}{350}\cdot\frac{81}{87} + \frac{263}{350}\cdot\frac{192}{263}.$$

Equivalently, the combined fraction is the mediant of the group fractions: add the numerators and add the denominators, (81 + 192)/(87 + 263). A mediant always lies between the fractions it combines, nearer to the one with the larger denominator.

Here is the theorem that makes the paradox possible, and the one that limits it.

Same weights preserve order. Suppose two arms have group rates a₁ > b₁ and a₂ > b₂, and the same weights w and 1 − w, with 0 ≤ w ≤ 1. Then w a₁ + (1 − w) a₂ > w b₁ + (1 − w) b₂.

The difference of the two sides is w(a₁ − b₁) + (1 − w)(a₂ − b₂). Both terms are non-negative, and since w and 1 − w cannot both be 0, at least one is positive. So the sum is positive. With common weights, a within-group advantage always survives aggregation.

With different weights there is no such guarantee. Open surgery’s weights are 87/350 ≈ 25% on the easier group and 75% on the harder one. Percutaneous treatment’s are 270/350 ≈ 77% and 23%. Both arms do better on the easier group, so the arm whose patients are mostly in the easier group has its average pulled up. That pull is larger than open surgery’s lead within each group, and the order reverses: 273/350 < 289/350.

Kidney-stone success rates by group and combined. Open surgery wins group 1 (93.1 vs 86.7 percent) and group 2 (73.0 vs 68.8 percent) but loses combined (78.0 vs 82.6 percent), because 77 percent of percutaneous cases are in the easier group 1 against 25 percent for open surgery.

The weights do the work. The same figure as Chapter 8: each arm’s combined bar is its own mix of the same group rates. With common weights the order would have to survive; with different weights it need not. The bars are the exact published fractions.

Simpson’s own 1951 table shows the milder outcome. The treated arm wins among men (8/13 > 4/7) and among women (12/27 > 2/5), and the combined rates are 20/40 and 6/12, both exactly 1/2. The advantage does not reverse. It disappears. Chapter 8 — When Every Group Says Yes (Part I, Chapter 7) checks both, and checks in particular that Simpson’s table is not a reversal, because the usual retelling says it is.

What the arithmetic does not say

The arithmetic is complete and exact, and it answers none of the questions a doctor would ask. Which table should guide a decision, the grouped one or the combined one? That depends on why the group mix differs between the arms, and the numbers cannot tell us.

  • If stone size influenced which treatment a patient received, and also influenced success, then size is a confounder. Comparing within groups is then the fairer comparison.
  • In other settings, the grouping variable is itself affected by the treatment. Then the combined table can be the right one, and grouping misleads.

Telling these situations apart needs knowledge of how the data arose, not more arithmetic. The modern theory of this, causal inference, is cited here and not developed. The Charig study was not randomised, and arm A pools three different operations, so the book draws no clinical conclusion from it. Chapter 19 returns to the line between what the numbers establish and what they are taken to mean.

Evidence note

All comparisons in this chapter are exact integer and fraction computations. The seven Simpson and kidney-stone statements are kernel-checked in Lean and Rocq (Chapter 8 — When Every Group Says Yes (Part I, Chapter 7)). The F₆ factorisation and the value of e^(π√163) were computed, not proved; the attribution to Landry rests on Williams (1993) and Brent (1999), and Landry’s 1880 note has not been read here; the causal discussion is cited, not checked. Full standing: Part IV, evidence tables.

Exercises

  1. Decide 192/263 against 55/80 by cross-multiplication, then by computing both to two decimals. Which method could have given the wrong answer for a closer pair?
  2. Arm A succeeds in 2 of 8 cases in group 1 and 5 of 5 in group 2; arm B succeeds in 1 of 5 in group 1 and 8 of 9 in group 2. Show that A wins both groups and loses combined.
  3. Prove that the mediant (a + c)/(b + d) lies between a/b and c/d when all four numbers are positive.
  4. In Python, compute int(float(2**64 + 1)) % 2 and (2**64 + 1) % 2. Explain the difference.
  5. Two expressions agree to 40 decimal places. Write one sentence saying what that establishes, and one saying what it does not.
  6. Without the 43 ureterolithotomies, open surgery’s group-1 rate is 38/44. Compare it with 234/270 exactly. What happens to the paradox?

Worked answers: Chapter 35 — Appendix A: Solutions to the Exercises (Part IV, Appendix A)#chapter-4-exact-numbers-and-misleading-aggregates.

Sources

  • F. Landry, note on the factorisation of 2⁶⁴ + 1, Comptes rendus de l’Académie des sciences 91 (1880), 138 (cited from Williams; not read here).
  • H. C. Williams, “How was F₆ factored?”, Mathematics of Computation 61 (1993), 463–474.
  • R. P. Brent, “Factorization of the tenth Fermat number”, Mathematics of Computation 68 (1999), 429–451: Table 1 credits F₆ = p6 · p14 to Landry, 1880.

Further Reading

For deeper study; not sources for the chapter’s claims.

  1. David Goldberg. “What every computer scientist should know about floating-point arithmetic.” ACM Computing Surveys 23(1) (1991), 5–48. DOI. Why read it: The standard survey of floating-point representation, rounding and the pitfalls the chapter demonstrates with F6 and with decimal arithmetic.
  2. Jean-Michel Muller, Nicolas Brunie, Florent de Dinechin, Claude-Pierre Jeannerod, Mioara Joldes, Vincent Lefèvre, Guillaume Melquiond, Nathalie Revol, Serge Torres. Handbook of Floating-Point Arithmetic (Springer, 2018). DOI. Why read it: A comprehensive modern reference on floating-point formats, algorithms and error analysis for readers who want the engineering detail behind the chapter’s warnings.
  3. Nicholas J. Higham. Accuracy and Stability of Numerical Algorithms (SIAM, 2002). DOI. Why read it: An authoritative treatment of rounding error and numerical stability, useful for understanding why exact arithmetic is a deliberate choice rather than a luxury.

Next in Part II: Chapter 14, maps, graphs and colourings.