FAILURE MAP
← Case archive

FA-11366 / Spreadsheet calculation semantics / Open access

An unused IF branch propagates its error · case 01

A valid chosen value is replaced by an error from an unchosen branch.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The evaluator evaluates both IF branches eagerly.

VERIFIED REPAIR

Evaluate only the selected branch.

Unsuccessful approach: Suppressing every branch error also suppresses an error in the selected branch.

Case contract

Each branch is a [numerator,denominator] integer division expression with both operands in the inclusive range -1000000 through 1000000. IF evaluates only its chosen branch, returning a binary floating-point quotient or #DIV/0! when its selected denominator is zero. This bounded model excludes overflow.

Why this case matters

This isolated spreadsheet model makes cell semantics explicit; it does not claim compatibility with every workbook engine.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(condition, yes, no):
    return '#DIV/0!' if yes[1] == 0 or no[1] == 0 else (yes[0]/yes[1] if condition else no[0]/no[1])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unused false branch error', solve(True,[N,1],[1,0]), N)
check('unused true branch error', solve(False,[1,0],[N,1]), N)
check('selected true error', solve(True,[N,0],[1,1]), '#DIV/0!')
check('selected false error', solve(False,[1,1],[N,0]), '#DIV/0!')
check('zero quotient', solve(True,[0,N],[1,0]), 0)
check('ordinary false choice', solve(False,[8,2],[-N,1]), -N)
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 fixtureActualExpectedOutcome
unused false branch error#DIV/0!1Failed
unused true branch error#DIV/0!1Failed
selected true error#DIV/0!#DIV/0!Passed
selected false error#DIV/0!#DIV/0!Passed
zero quotient#DIV/0!0Failed
ordinary false choice-1.0-1Passed

SHA-256 / 9309c1d79896e4eab342538e61cd95a644ef7e1ec043421839029056ed423d66

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(condition, yes, no):
    branch = yes if condition else no
    return 0 if branch[1] == 0 else branch[0]/branch[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unused false branch error', solve(True,[N,1],[1,0]), N)
check('unused true branch error', solve(False,[1,0],[N,1]), N)
check('selected true error', solve(True,[N,0],[1,1]), '#DIV/0!')
check('selected false error', solve(False,[1,1],[N,0]), '#DIV/0!')
check('zero quotient', solve(True,[0,N],[1,0]), 0)
check('ordinary false choice', solve(False,[8,2],[-N,1]), -N)
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 fixtureActualExpectedOutcome
unused false branch error1.01Passed
unused true branch error1.01Passed
selected true error0#DIV/0!Failed
selected false error0#DIV/0!Failed
zero quotient0.00Passed
ordinary false choice-1.0-1Passed

SHA-256 / e7fc2dec2eab83731cb18b08bfc245fedff2f55a6685f5d5b99f3212e214b78d

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(condition, yes, no):
    branch = yes if condition else no
    return '#DIV/0!' if branch[1] == 0 else branch[0]/branch[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unused false branch error', solve(True,[N,1],[1,0]), N)
check('unused true branch error', solve(False,[1,0],[N,1]), N)
check('selected true error', solve(True,[N,0],[1,1]), '#DIV/0!')
check('selected false error', solve(False,[1,1],[N,0]), '#DIV/0!')
check('zero quotient', solve(True,[0,N],[1,0]), 0)
check('ordinary false choice', solve(False,[8,2],[-N,1]), -N)
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 fixtureActualExpectedOutcome
unused false branch error1.01Passed
unused true branch error1.01Passed
selected true error#DIV/0!#DIV/0!Passed
selected false error#DIV/0!#DIV/0!Passed
zero quotient0.00Passed
ordinary false choice-1.0-1Passed

SHA-256 / 2a5047a6f178b5e480169b8e2f3f6704a2b905d0e0e899147526e42d44082dc7

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:38:47.356492+00:00.

Case digest / d8cca741556fe0fdc16e0167db3713057c0e3228e0b84e18aab8385d988e8e32