{"abstract":"Decimal quantization substitutes half-up rounding for half-even.","category":"Floating-point arithmetic","checks":11,"contract":"Quantize a decimal text to 10**exponent using a fresh precision-limited decimal context, half-even rounding, Emin=-9 and Emax=9. All traps are disabled; return result string and raised flag names. The coefficient precision includes trailing zeros imposed by the target quantum.","evaluation_group":"s3-float-decimal-quantum","failed_approach":"The attempted local correction ctx=Context(prec=precision,rounding=ROUND_DOWN,Emin=-9,Emax=9) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-decimal-quantum-rounding-context","id":"FA-16891","implementations":{"attempt":{"sha256":"a2f24c15a96d176a010589da10cf1653fc9c3227a2a0745e34a63d3d7ff17dc4","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(text, exponent, precision):\n    ctx=Context(prec=precision,rounding=ROUND_DOWN,Emin=-9,Emax=9)\n    for signal in ctx.traps: ctx.traps[signal]=False\n    ctx.clear_flags()\n    value=Decimal(text)\n    quantum=Decimal((0,(1,),exponent))\n    result=ctx.quantize(value,quantum)\n    flags=sorted(signal.__name__ for signal,raised in ctx.flags.items() if raised)\n    return [str(result),flags]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('tie odd', solve(str(N)+\".255\",-2,6), [str(N)+\".26\",[\"Inexact\",\"Rounded\"]])\ncheck('tie even', solve(str(N)+\".245\",-2,6), [str(N)+\".24\",[\"Inexact\",\"Rounded\"]])\ncheck('rounded exact', solve(str(N)+\".200\",-2,6), [str(N)+\".20\",[\"Rounded\"]])\ncheck('already exact', solve(str(N)+\".20\",-2,6), [str(N)+\".20\",[]])\ncheck('one excess digit', solve(\"123.45\",-2,4), [\"NaN\",[\"InvalidOperation\"]])\ncheck('coefficient too large', solve(\"12345.67\",-2,4), [\"NaN\",[\"InvalidOperation\"]])\ncheck('subnormal exact', solve(\"1e-10\",-10,6), [\"1E-10\",[\"Subnormal\"]])\ncheck('negative zero', solve(\"-0.004\",-2,6), [\"-0.00\",[\"Inexact\",\"Rounded\"]])\ncheck('positive zero', solve(\"0.004\",-2,6), [\"0.00\",[\"Inexact\",\"Rounded\"]])\ncheck('integer quantum', solve(\"123.4\",1,6), [\"1.2E+2\",[\"Inexact\",\"Rounded\"]])\ncheck('overflow exponent', solve(\"1e10\",0,6), [\"NaN\",[\"InvalidOperation\"]])\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":"c881a9461db99724cb278ca592fb12f06ff8b2ee90106200fddda4704b53954c","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(text, exponent, precision):\n    ctx=Context(prec=precision,rounding=ROUND_HALF_UP,Emin=-9,Emax=9)\n    for signal in ctx.traps: ctx.traps[signal]=False\n    ctx.clear_flags()\n    value=Decimal(text)\n    quantum=Decimal((0,(1,),exponent))\n    result=ctx.quantize(value,quantum)\n    flags=sorted(signal.__name__ for signal,raised in ctx.flags.items() if raised)\n    return [str(result),flags]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('tie odd', solve(str(N)+\".255\",-2,6), [str(N)+\".26\",[\"Inexact\",\"Rounded\"]])\ncheck('tie even', solve(str(N)+\".245\",-2,6), [str(N)+\".24\",[\"Inexact\",\"Rounded\"]])\ncheck('rounded exact', solve(str(N)+\".200\",-2,6), [str(N)+\".20\",[\"Rounded\"]])\ncheck('already exact', solve(str(N)+\".20\",-2,6), [str(N)+\".20\",[]])\ncheck('one excess digit', solve(\"123.45\",-2,4), [\"NaN\",[\"InvalidOperation\"]])\ncheck('coefficient too large', solve(\"12345.67\",-2,4), [\"NaN\",[\"InvalidOperation\"]])\ncheck('subnormal exact', solve(\"1e-10\",-10,6), [\"1E-10\",[\"Subnormal\"]])\ncheck('negative zero', solve(\"-0.004\",-2,6), [\"-0.00\",[\"Inexact\",\"Rounded\"]])\ncheck('positive zero', solve(\"0.004\",-2,6), [\"0.00\",[\"Inexact\",\"Rounded\"]])\ncheck('integer quantum', solve(\"123.4\",1,6), [\"1.2E+2\",[\"Inexact\",\"Rounded\"]])\ncheck('overflow exponent', solve(\"1e10\",0,6), [\"NaN\",[\"InvalidOperation\"]])\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":"460468a042fcf6d67d4cb763ba48f3f98f817466899bf87246a676393d0e8269","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(text, exponent, precision):\n    ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN,Emin=-9,Emax=9)\n    for signal in ctx.traps: ctx.traps[signal]=False\n    ctx.clear_flags()\n    value=Decimal(text)\n    quantum=Decimal((0,(1,),exponent))\n    result=ctx.quantize(value,quantum)\n    flags=sorted(signal.__name__ for signal,raised in ctx.flags.items() if raised)\n    return [str(result),flags]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('tie odd', solve(str(N)+\".255\",-2,6), [str(N)+\".26\",[\"Inexact\",\"Rounded\"]])\ncheck('tie even', solve(str(N)+\".245\",-2,6), [str(N)+\".24\",[\"Inexact\",\"Rounded\"]])\ncheck('rounded exact', solve(str(N)+\".200\",-2,6), [str(N)+\".20\",[\"Rounded\"]])\ncheck('already exact', solve(str(N)+\".20\",-2,6), [str(N)+\".20\",[]])\ncheck('one excess digit', solve(\"123.45\",-2,4), [\"NaN\",[\"InvalidOperation\"]])\ncheck('coefficient too large', solve(\"12345.67\",-2,4), [\"NaN\",[\"InvalidOperation\"]])\ncheck('subnormal exact', solve(\"1e-10\",-10,6), [\"1E-10\",[\"Subnormal\"]])\ncheck('negative zero', solve(\"-0.004\",-2,6), [\"-0.00\",[\"Inexact\",\"Rounded\"]])\ncheck('positive zero', solve(\"0.004\",-2,6), [\"0.00\",[\"Inexact\",\"Rounded\"]])\ncheck('integer quantum', solve(\"123.4\",1,6), [\"1.2E+2\",[\"Inexact\",\"Rounded\"]])\ncheck('overflow exponent', solve(\"1e10\",0,6), [\"NaN\",[\"InvalidOperation\"]])\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-quantum-rounding-context","generated_at":"2026-09-29T14:39:40.962130+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,Emin=-9,Emax=9).","root_cause":"Decimal quantization substitutes half-up rounding for half-even. The faulty expression is ctx=Context(prec=precision,rounding=ROUND_HALF_UP,Emin=-9,Emax=9).","sha256":"a1e6b787c6e5215c5afddd3ac61cf27f1360e1d4a96b8c62eebc19df8c763cc0","title":"Decimal quantization substitutes half-up rounding for half-even · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.914,"exit_code":1,"observations":[{"actual":["1.25",["Inexact","Rounded"]],"check":"tie odd","expected":["1.26",["Inexact","Rounded"]],"passed":false},{"actual":["1.24",["Inexact","Rounded"]],"check":"tie even","expected":["1.24",["Inexact","Rounded"]],"passed":true},{"actual":["1.20",["Rounded"]],"check":"rounded exact","expected":["1.20",["Rounded"]],"passed":true},{"actual":["1.20",[]],"check":"already exact","expected":["1.20",[]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"one excess digit","expected":["NaN",["InvalidOperation"]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"coefficient too large","expected":["NaN",["InvalidOperation"]],"passed":true},{"actual":["1E-10",["Subnormal"]],"check":"subnormal exact","expected":["1E-10",["Subnormal"]],"passed":true},{"actual":["-0.00",["Inexact","Rounded"]],"check":"negative zero","expected":["-0.00",["Inexact","Rounded"]],"passed":true},{"actual":["0.00",["Inexact","Rounded"]],"check":"positive zero","expected":["0.00",["Inexact","Rounded"]],"passed":true},{"actual":["1.2E+2",["Inexact","Rounded"]],"check":"integer quantum","expected":["1.2E+2",["Inexact","Rounded"]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"overflow exponent","expected":["NaN",["InvalidOperation"]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tie odd\", \"actual\": [\"1.25\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.26\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"tie even\", \"actual\": [\"1.24\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.24\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"rounded exact\", \"actual\": [\"1.20\", [\"Rounded\"]], \"expected\": [\"1.20\", [\"Rounded\"]], \"passed\": true}, {\"check\": \"already exact\", \"actual\": [\"1.20\", []], \"expected\": [\"1.20\", []], \"passed\": true}, {\"check\": \"one excess digit\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}, {\"check\": \"coefficient too large\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}, {\"check\": \"subnormal exact\", \"actual\": [\"1E-10\", [\"Subnormal\"]], \"expected\": [\"1E-10\", [\"Subnormal\"]], \"passed\": true}, {\"check\": \"negative zero\", \"actual\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"positive zero\", \"actual\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"integer quantum\", \"actual\": [\"1.2E+2\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.2E+2\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"overflow exponent\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.337,"exit_code":1,"observations":[{"actual":["1.26",["Inexact","Rounded"]],"check":"tie odd","expected":["1.26",["Inexact","Rounded"]],"passed":true},{"actual":["1.25",["Inexact","Rounded"]],"check":"tie even","expected":["1.24",["Inexact","Rounded"]],"passed":false},{"actual":["1.20",["Rounded"]],"check":"rounded exact","expected":["1.20",["Rounded"]],"passed":true},{"actual":["1.20",[]],"check":"already exact","expected":["1.20",[]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"one excess digit","expected":["NaN",["InvalidOperation"]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"coefficient too large","expected":["NaN",["InvalidOperation"]],"passed":true},{"actual":["1E-10",["Subnormal"]],"check":"subnormal exact","expected":["1E-10",["Subnormal"]],"passed":true},{"actual":["-0.00",["Inexact","Rounded"]],"check":"negative zero","expected":["-0.00",["Inexact","Rounded"]],"passed":true},{"actual":["0.00",["Inexact","Rounded"]],"check":"positive zero","expected":["0.00",["Inexact","Rounded"]],"passed":true},{"actual":["1.2E+2",["Inexact","Rounded"]],"check":"integer quantum","expected":["1.2E+2",["Inexact","Rounded"]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"overflow exponent","expected":["NaN",["InvalidOperation"]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tie odd\", \"actual\": [\"1.26\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.26\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"tie even\", \"actual\": [\"1.25\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.24\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"rounded exact\", \"actual\": [\"1.20\", [\"Rounded\"]], \"expected\": [\"1.20\", [\"Rounded\"]], \"passed\": true}, {\"check\": \"already exact\", \"actual\": [\"1.20\", []], \"expected\": [\"1.20\", []], \"passed\": true}, {\"check\": \"one excess digit\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}, {\"check\": \"coefficient too large\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}, {\"check\": \"subnormal exact\", \"actual\": [\"1E-10\", [\"Subnormal\"]], \"expected\": [\"1E-10\", [\"Subnormal\"]], \"passed\": true}, {\"check\": \"negative zero\", \"actual\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"positive zero\", \"actual\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"integer quantum\", \"actual\": [\"1.2E+2\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.2E+2\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"overflow exponent\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.127,"exit_code":0,"observations":[{"actual":["1.26",["Inexact","Rounded"]],"check":"tie odd","expected":["1.26",["Inexact","Rounded"]],"passed":true},{"actual":["1.24",["Inexact","Rounded"]],"check":"tie even","expected":["1.24",["Inexact","Rounded"]],"passed":true},{"actual":["1.20",["Rounded"]],"check":"rounded exact","expected":["1.20",["Rounded"]],"passed":true},{"actual":["1.20",[]],"check":"already exact","expected":["1.20",[]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"one excess digit","expected":["NaN",["InvalidOperation"]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"coefficient too large","expected":["NaN",["InvalidOperation"]],"passed":true},{"actual":["1E-10",["Subnormal"]],"check":"subnormal exact","expected":["1E-10",["Subnormal"]],"passed":true},{"actual":["-0.00",["Inexact","Rounded"]],"check":"negative zero","expected":["-0.00",["Inexact","Rounded"]],"passed":true},{"actual":["0.00",["Inexact","Rounded"]],"check":"positive zero","expected":["0.00",["Inexact","Rounded"]],"passed":true},{"actual":["1.2E+2",["Inexact","Rounded"]],"check":"integer quantum","expected":["1.2E+2",["Inexact","Rounded"]],"passed":true},{"actual":["NaN",["InvalidOperation"]],"check":"overflow exponent","expected":["NaN",["InvalidOperation"]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tie odd\", \"actual\": [\"1.26\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.26\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"tie even\", \"actual\": [\"1.24\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.24\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"rounded exact\", \"actual\": [\"1.20\", [\"Rounded\"]], \"expected\": [\"1.20\", [\"Rounded\"]], \"passed\": true}, {\"check\": \"already exact\", \"actual\": [\"1.20\", []], \"expected\": [\"1.20\", []], \"passed\": true}, {\"check\": \"one excess digit\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}, {\"check\": \"coefficient too large\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}, {\"check\": \"subnormal exact\", \"actual\": [\"1E-10\", [\"Subnormal\"]], \"expected\": [\"1E-10\", [\"Subnormal\"]], \"passed\": true}, {\"check\": \"negative zero\", \"actual\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"positive zero\", \"actual\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"integer quantum\", \"actual\": [\"1.2E+2\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"1.2E+2\", [\"Inexact\", \"Rounded\"]], \"passed\": true}, {\"check\": \"overflow exponent\", \"actual\": [\"NaN\", [\"InvalidOperation\"]], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}