FA-346 / Floating-point arithmetic / Open access
A geometric-mean product overflows although the result is finite · case 01
Multiplying observations produces infinity or zero even when their geometric mean is a representable positive number.
ROOT CAUSE
The implementation materializes an extreme product before applying the nth root.
VERIFIED REPAIR
Average logarithms with accurate summation and exponentiate once, avoiding the unrepresentable intermediate product.
Unsuccessful approach: Saturating each product at the largest float discards magnitude and does not repair underflow.
Case contract
For a nonempty sequence of finite positive floats, return a logarithm-based geometric mean formatted with ten significant digits. Empty input or any nonpositive observation returns None. Fixtures remain within the representable range of the final mean.
Why this case matters
Multiplicative metrics and ratios can span enormous ranges while their mean stays ordinary. Bounding an intermediate product changes the statistic rather than stabilizing it.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import sys
N = 1
observations = []
def solve(values):
if not values or any(value <= 0 for value in values):
return None
return format(math.prod(values) ** (1 / len(values)), '.10g')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('finite mean despite overflowing product', solve([1e150] * (N + 2)), '1e+150')
check('finite mean despite underflowing product', solve([1e-200] * (N + 1)), '1e-200')
check('balanced reciprocal scales', solve([1e300, 1e-300] * N), '1')
check('ordinary square-root case', solve([4.0, 9.0]), '6')
check('one observation', solve([float(N)]), str(N))
check('unit-valued observations', solve([1.0] * (N + 1)), '1')
check('zero observation rejected', solve([0.0, 1.0]), None)
check('negative observation rejected', solve([-1.0, 2.0]), None)
check('empty sequence', solve([]), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| finite mean despite overflowing product | inf | 1e+150 | Failed |
| finite mean despite underflowing product | 0 | 1e-200 | Failed |
| balanced reciprocal scales | 1 | 1 | Passed |
| ordinary square-root case | 6 | 6 | Passed |
| one observation | 1 | 1 | Passed |
| unit-valued observations | 1 | 1 | Passed |
| zero observation rejected | None | None | Passed |
| negative observation rejected | None | None | Passed |
| empty sequence | None | None | Passed |
SHA-256 / c4d67fdd217aa723bbcec46fb9b20c91693a426d7cbab5cc7f2040ce37584351
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import sys
N = 1
observations = []
def solve(values):
if not values or any(value <= 0 for value in values):
return None
product = 1.0
for value in values:
product = min(product * value, sys.float_info.max)
return format(product ** (1 / len(values)), '.10g')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('finite mean despite overflowing product', solve([1e150] * (N + 2)), '1e+150')
check('finite mean despite underflowing product', solve([1e-200] * (N + 1)), '1e-200')
check('balanced reciprocal scales', solve([1e300, 1e-300] * N), '1')
check('ordinary square-root case', solve([4.0, 9.0]), '6')
check('one observation', solve([float(N)]), str(N))
check('unit-valued observations', solve([1.0] * (N + 1)), '1')
check('zero observation rejected', solve([0.0, 1.0]), None)
check('negative observation rejected', solve([-1.0, 2.0]), None)
check('empty sequence', solve([]), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| finite mean despite overflowing product | 5.643803094e+102 | 1e+150 | Failed |
| finite mean despite underflowing product | 0 | 1e-200 | Failed |
| balanced reciprocal scales | 1 | 1 | Passed |
| ordinary square-root case | 6 | 6 | Passed |
| one observation | 1 | 1 | Passed |
| unit-valued observations | 1 | 1 | Passed |
| zero observation rejected | None | None | Passed |
| negative observation rejected | None | None | Passed |
| empty sequence | None | None | Passed |
SHA-256 / bd6be5f6346a2ab28039ce564d4dc8b237e4f688ae0bb9fe1e74275c6de6989f
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import sys
N = 1
observations = []
def solve(values):
if not values or any(value <= 0 for value in values):
return None
mean_log = math.fsum(math.log(value) for value in values) / len(values)
return format(math.exp(mean_log), '.10g')
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('finite mean despite overflowing product', solve([1e150] * (N + 2)), '1e+150')
check('finite mean despite underflowing product', solve([1e-200] * (N + 1)), '1e-200')
check('balanced reciprocal scales', solve([1e300, 1e-300] * N), '1')
check('ordinary square-root case', solve([4.0, 9.0]), '6')
check('one observation', solve([float(N)]), str(N))
check('unit-valued observations', solve([1.0] * (N + 1)), '1')
check('zero observation rejected', solve([0.0, 1.0]), None)
check('negative observation rejected', solve([-1.0, 2.0]), None)
check('empty sequence', solve([]), None)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| finite mean despite overflowing product | 1e+150 | 1e+150 | Passed |
| finite mean despite underflowing product | 1e-200 | 1e-200 | Passed |
| balanced reciprocal scales | 1 | 1 | Passed |
| ordinary square-root case | 6 | 6 | Passed |
| one observation | 1 | 1 | Passed |
| unit-valued observations | 1 | 1 | Passed |
| zero observation rejected | None | None | Passed |
| negative observation rejected | None | None | Passed |
| empty sequence | None | None | Passed |
SHA-256 / 2acc28c9f45f1b5279b9a6852aa70ad62b40789e6f8a4627c7c5f012f3b4bd68
Verification & scope
This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:36:52.141252+00:00.
Case digest / c01b36d90aa6f56fd6d12d0a005abb2c3f020135405ba60bcf6bc34138f789c1