{"abstract":"Decimal fused multiply-add applies the wrong addend sign.","category":"Floating-point arithmetic","checks":7,"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.","evaluation_group":"s3-float-decimal-fma","failed_approach":"The attempted local correction result=ctx.fma(av,bv,abs(cv)) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-decimal-fma-subtract-addend","id":"FA-16941","implementations":{"attempt":{"sha256":"4e81c8c129983662517be59a48befdffb5d1ef488234a7dcf271b089598c4726","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport decimal\nfrom decimal import Decimal, Context, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_DOWN\n\nN = 1\nobservations = []\ndef solve(a,b,c,precision):\n    ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN)\n    for signal in ctx.traps: ctx.traps[signal]=False\n    av=Decimal(a); bv=Decimal(b); cv=Decimal(c)\n    result=ctx.fma(av,bv,abs(cv))\n    return [str(result),ctx.flags[decimal.Inexact]]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('cancellation', solve(\"1.23\",\"4.56\",\"-5.61\",3), [\"-0.0012\",False])\ncheck('opposite cancellation', solve(\"-1.23\",\"4.56\",\"5.61\",3), [\"0.0012\",False])\ncheck('tiny addend', solve(\"1\",\"1\",\"0.005\",3), [\"1.00\",True])\ncheck('odd tie', solve(\"1\",\"1\",\"0.015\",3), [\"1.02\",True])\ncheck('variable exact', solve(str(N),\"2\",\"3\",3), [str(2*N+3),False])\ncheck('addend precision', solve(\"1.23456\",\"1\",\"-1.23455\",3), [\"0.00001\",False])\ncheck('operand precision', solve(\"1.23456\",\"1\",\"0\",3), [\"1.23\",True])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"60fa91ecf4b5f912354daa12f35db1e8837cb130be52373e71c4e499fa660f03","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport decimal\nfrom decimal import Decimal, Context, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_DOWN\n\nN = 1\nobservations = []\ndef solve(a,b,c,precision):\n    ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN)\n    for signal in ctx.traps: ctx.traps[signal]=False\n    av=Decimal(a); bv=Decimal(b); cv=Decimal(c)\n    result=ctx.fma(av,bv,-cv)\n    return [str(result),ctx.flags[decimal.Inexact]]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('cancellation', solve(\"1.23\",\"4.56\",\"-5.61\",3), [\"-0.0012\",False])\ncheck('opposite cancellation', solve(\"-1.23\",\"4.56\",\"5.61\",3), [\"0.0012\",False])\ncheck('tiny addend', solve(\"1\",\"1\",\"0.005\",3), [\"1.00\",True])\ncheck('odd tie', solve(\"1\",\"1\",\"0.015\",3), [\"1.02\",True])\ncheck('variable exact', solve(str(N),\"2\",\"3\",3), [str(2*N+3),False])\ncheck('addend precision', solve(\"1.23456\",\"1\",\"-1.23455\",3), [\"0.00001\",False])\ncheck('operand precision', solve(\"1.23456\",\"1\",\"0\",3), [\"1.23\",True])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"0d52afe8b9db5d3cadaea9f6fd4c5d883b9ff4a635253fac0edc3dbc092ce339","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport decimal\nfrom decimal import Decimal, Context, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_DOWN\n\nN = 1\nobservations = []\ndef solve(a,b,c,precision):\n    ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN)\n    for signal in ctx.traps: ctx.traps[signal]=False\n    av=Decimal(a); bv=Decimal(b); cv=Decimal(c)\n    result=ctx.fma(av,bv,cv)\n    return [str(result),ctx.flags[decimal.Inexact]]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('cancellation', solve(\"1.23\",\"4.56\",\"-5.61\",3), [\"-0.0012\",False])\ncheck('opposite cancellation', solve(\"-1.23\",\"4.56\",\"5.61\",3), [\"0.0012\",False])\ncheck('tiny addend', solve(\"1\",\"1\",\"0.005\",3), [\"1.00\",True])\ncheck('odd tie', solve(\"1\",\"1\",\"0.015\",3), [\"1.02\",True])\ncheck('variable exact', solve(str(N),\"2\",\"3\",3), [str(2*N+3),False])\ncheck('addend precision', solve(\"1.23456\",\"1\",\"-1.23455\",3), [\"0.00001\",False])\ncheck('operand precision', solve(\"1.23456\",\"1\",\"0\",3), [\"1.23\",True])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"s3-floating_point_arithmetic-decimal-fma-subtract-addend","generated_at":"2026-09-29T14:39:41.462319+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"An offline floating representation model isolates a reproducible arithmetic fault.","repair":"Apply the contract at this fault site using result=ctx.fma(av,bv,cv).","root_cause":"Decimal fused multiply-add applies the wrong addend sign. The faulty expression is result=ctx.fma(av,bv,-cv).","sha256":"8fd8f3ef345251c48379ccff45c3f2ccefffe8c22efac7a95c67d5ccd03b57ac","title":"Decimal fused multiply-add applies the wrong addend sign · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":47.786,"exit_code":1,"observations":[{"actual":["11.2",true],"check":"cancellation","expected":["-0.0012",false],"passed":false},{"actual":["0.0012",false],"check":"opposite cancellation","expected":["0.0012",false],"passed":true},{"actual":["1.00",true],"check":"tiny addend","expected":["1.00",true],"passed":true},{"actual":["1.02",true],"check":"odd tie","expected":["1.02",true],"passed":true},{"actual":["5",false],"check":"variable exact","expected":["5",false],"passed":true},{"actual":["2.47",true],"check":"addend precision","expected":["0.00001",false],"passed":false},{"actual":["1.23",true],"check":"operand precision","expected":["1.23",true],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"cancellation\", \"actual\": [\"11.2\", true], \"expected\": [\"-0.0012\", false], \"passed\": false}, {\"check\": \"opposite cancellation\", \"actual\": [\"0.0012\", false], \"expected\": [\"0.0012\", false], \"passed\": true}, {\"check\": \"tiny addend\", \"actual\": [\"1.00\", true], \"expected\": [\"1.00\", true], \"passed\": true}, {\"check\": \"odd tie\", \"actual\": [\"1.02\", true], \"expected\": [\"1.02\", true], \"passed\": true}, {\"check\": \"variable exact\", \"actual\": [\"5\", false], \"expected\": [\"5\", false], \"passed\": true}, {\"check\": \"addend precision\", \"actual\": [\"2.47\", true], \"expected\": [\"0.00001\", false], \"passed\": false}, {\"check\": \"operand precision\", \"actual\": [\"1.23\", true], \"expected\": [\"1.23\", true], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.058,"exit_code":1,"observations":[{"actual":["11.2",true],"check":"cancellation","expected":["-0.0012",false],"passed":false},{"actual":["-11.2",true],"check":"opposite cancellation","expected":["0.0012",false],"passed":false},{"actual":["0.995",false],"check":"tiny addend","expected":["1.00",true],"passed":false},{"actual":["0.985",false],"check":"odd tie","expected":["1.02",true],"passed":false},{"actual":["-1",false],"check":"variable exact","expected":["5",false],"passed":false},{"actual":["2.47",true],"check":"addend precision","expected":["0.00001",false],"passed":false},{"actual":["1.23",true],"check":"operand precision","expected":["1.23",true],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"cancellation\", \"actual\": [\"11.2\", true], \"expected\": [\"-0.0012\", false], \"passed\": false}, {\"check\": \"opposite cancellation\", \"actual\": [\"-11.2\", true], \"expected\": [\"0.0012\", false], \"passed\": false}, {\"check\": \"tiny addend\", \"actual\": [\"0.995\", false], \"expected\": [\"1.00\", true], \"passed\": false}, {\"check\": \"odd tie\", \"actual\": [\"0.985\", false], \"expected\": [\"1.02\", true], \"passed\": false}, {\"check\": \"variable exact\", \"actual\": [\"-1\", false], \"expected\": [\"5\", false], \"passed\": false}, {\"check\": \"addend precision\", \"actual\": [\"2.47\", true], \"expected\": [\"0.00001\", false], \"passed\": false}, {\"check\": \"operand precision\", \"actual\": [\"1.23\", true], \"expected\": [\"1.23\", true], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.642,"exit_code":0,"observations":[{"actual":["-0.0012",false],"check":"cancellation","expected":["-0.0012",false],"passed":true},{"actual":["0.0012",false],"check":"opposite cancellation","expected":["0.0012",false],"passed":true},{"actual":["1.00",true],"check":"tiny addend","expected":["1.00",true],"passed":true},{"actual":["1.02",true],"check":"odd tie","expected":["1.02",true],"passed":true},{"actual":["5",false],"check":"variable exact","expected":["5",false],"passed":true},{"actual":["0.00001",false],"check":"addend precision","expected":["0.00001",false],"passed":true},{"actual":["1.23",true],"check":"operand precision","expected":["1.23",true],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"cancellation\", \"actual\": [\"-0.0012\", false], \"expected\": [\"-0.0012\", false], \"passed\": true}, {\"check\": \"opposite cancellation\", \"actual\": [\"0.0012\", false], \"expected\": [\"0.0012\", false], \"passed\": true}, {\"check\": \"tiny addend\", \"actual\": [\"1.00\", true], \"expected\": [\"1.00\", true], \"passed\": true}, {\"check\": \"odd tie\", \"actual\": [\"1.02\", true], \"expected\": [\"1.02\", true], \"passed\": true}, {\"check\": \"variable exact\", \"actual\": [\"5\", false], \"expected\": [\"5\", false], \"passed\": true}, {\"check\": \"addend precision\", \"actual\": [\"0.00001\", false], \"expected\": [\"0.00001\", false], \"passed\": true}, {\"check\": \"operand precision\", \"actual\": [\"1.23\", true], \"expected\": [\"1.23\", true], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}