FA-16936 / Floating-point arithmetic / Open access
Decimal fused multiply-add forgets its local context · case 01
Decimal fused multiply-add forgets its local context.
ROOT CAUSE
Decimal fused multiply-add forgets its local context. The faulty expression is result=av.fma(bv,cv).
THE FAILURE
Decimal fused multiply-add forgets its local context. The faulty expression is result=av.fma(bv,cv).
Unsuccessful approach: The attempted local correction result=av*bv+cv still violates the explicit regression fixtures.
Case contract
Decimal fused multiply-add rounds a*b+c once in a fresh precision-limited half-even context. Inputs are decimal strings; return final decimal string and Inexact flag.
Why this case matters
An offline floating representation model isolates a reproducible arithmetic fault.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import decimal
from decimal import Decimal, Context, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_DOWN
N = 1
observations = []
def solve(a,b,c,precision):
ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN)
for signal in ctx.traps: ctx.traps[signal]=False
av=Decimal(a); bv=Decimal(b); cv=Decimal(c)
result=av.fma(bv,cv)
return [str(result),ctx.flags[decimal.Inexact]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancellation', solve("1.23","4.56","-5.61",3), ["-0.0012",False])
check('opposite cancellation', solve("-1.23","4.56","5.61",3), ["0.0012",False])
check('tiny addend', solve("1","1","0.005",3), ["1.00",True])
check('odd tie', solve("1","1","0.015",3), ["1.02",True])
check('variable exact', solve(str(N),"2","3",3), [str(2*N+3),False])
check('addend precision', solve("1.23456","1","-1.23455",3), ["0.00001",False])
check('operand precision', solve("1.23456","1","0",3), ["1.23",True])
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 |
|---|---|---|---|
| cancellation | ['-0.0012', False] | ['-0.0012', False] | Passed |
| opposite cancellation | ['0.0012', False] | ['0.0012', False] | Passed |
| tiny addend | ['1.005', False] | ['1.00', True] | Failed |
| odd tie | ['1.015', False] | ['1.02', True] | Failed |
| variable exact | ['5', False] | ['5', False] | Passed |
| addend precision | ['0.00001', False] | ['0.00001', False] | Passed |
| operand precision | ['1.23456', False] | ['1.23', True] | Failed |
SHA-256 / 37ee72bc0b25c4c748bf8e7d9320184d92865dde2de7770ff4889b4b02c8618c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import decimal
from decimal import Decimal, Context, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_DOWN
N = 1
observations = []
def solve(a,b,c,precision):
ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN)
for signal in ctx.traps: ctx.traps[signal]=False
av=Decimal(a); bv=Decimal(b); cv=Decimal(c)
result=av*bv+cv
return [str(result),ctx.flags[decimal.Inexact]]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancellation', solve("1.23","4.56","-5.61",3), ["-0.0012",False])
check('opposite cancellation', solve("-1.23","4.56","5.61",3), ["0.0012",False])
check('tiny addend', solve("1","1","0.005",3), ["1.00",True])
check('odd tie', solve("1","1","0.015",3), ["1.02",True])
check('variable exact', solve(str(N),"2","3",3), [str(2*N+3),False])
check('addend precision', solve("1.23456","1","-1.23455",3), ["0.00001",False])
check('operand precision', solve("1.23456","1","0",3), ["1.23",True])
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 |
|---|---|---|---|
| cancellation | ['-0.0012', False] | ['-0.0012', False] | Passed |
| opposite cancellation | ['0.0012', False] | ['0.0012', False] | Passed |
| tiny addend | ['1.005', False] | ['1.00', True] | Failed |
| odd tie | ['1.015', False] | ['1.02', True] | Failed |
| variable exact | ['5', False] | ['5', False] | Passed |
| addend precision | ['0.00001', False] | ['0.00001', False] | Passed |
| operand precision | ['1.23456', False] | ['1.23', True] | Failed |
SHA-256 / 8336e4f18cfc2fa22a87b21194c65702429232d50e0da86e320959c3aae260e6
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
Controlled binary64 or explicitly stipulated miniature format; no hardware exception flags or platform floating environment are modeled. 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:39:41.621633+00:00.
Case digest / b84aa94b7cc9b4184fd683d030b418ebe16a1b1eb58818b9073344fd91b5a14b