{"abstract":"Decimal fused multiply-add uses away ties in an even context.","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 ctx=Context(prec=precision,rounding=ROUND_DOWN) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-decimal-fma-half-up-fma","id":"FA-16946","implementations":{"attempt":{"sha256":"b19fd7f2d632eb0fce02e8dc99b13b310666d3ee2a923b81e4d0e36ae02b3dff","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_DOWN)\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"},"broken":{"sha256":"99dc770125d5ba4454e4de24817d3cb74bea5b0bd491aa98ee988cf3137af4af","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_UP)\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-half-up-fma","generated_at":"2026-09-29T14:39:41.602740+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 ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN).","root_cause":"Decimal fused multiply-add uses away ties in an even context. The faulty expression is ctx=Context(prec=precision,rounding=ROUND_HALF_UP).","sha256":"c44d856661e6198e1f94fcf592e357dd1087f898ba08707ed0a231000b1d04c1","title":"Decimal fused multiply-add uses away ties in an even context · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.68,"exit_code":1,"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.01",true],"check":"odd tie","expected":["1.02",true],"passed":false},{"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":false,"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.01\", true], \"expected\": [\"1.02\", true], \"passed\": false}, {\"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\": false}\n"},"broken":{"elapsed_ms":46.112,"exit_code":1,"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.01",true],"check":"tiny addend","expected":["1.00",true],"passed":false},{"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":false,"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.01\", true], \"expected\": [\"1.00\", true], \"passed\": false}, {\"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\": false}\n"},"fixed":{"elapsed_ms":43.267,"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"}