{"abstract":"Decimal quantization creates a context but uses the ambient one.","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.","contract_signature":"text, exponent, precision","evaluation_group":"s3-float-decimal-quantum","failed_approach":"The attempted local correction result=value.quantize(quantum,rounding=ROUND_HALF_EVEN) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-decimal-quantum-wrong-context-use","id":"FA-16921","implementations":{"attempt":{"sha256":"a1cff283b0168ade27d68cce42ed8fdbf859a7270261eb39b17807769843668b","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=value.quantize(quantum,rounding=ROUND_HALF_EVEN)\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":"de3a21b50baa784365b3bfaacb590509b09e0c690c02d7fa648c019d352c2e62","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=value.quantize(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-wrong-context-use","generated_at":"2026-09-29T14:39:41.139976+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.","root_cause":"Decimal quantization creates a context but uses the ambient one. The faulty expression is result=value.quantize(quantum).","sha256":"32abee37ce53e1a2b3623fee1d4942db2b82211c1a95c1cec6dd154e63d27154","title":"Decimal quantization creates a context but uses the ambient one · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":42.933,"exit_code":1,"observations":[{"actual":["1.26",[]],"check":"tie odd","expected":["1.26",["Inexact","Rounded"]],"passed":false},{"actual":["1.24",[]],"check":"tie even","expected":["1.24",["Inexact","Rounded"]],"passed":false},{"actual":["1.20",[]],"check":"rounded exact","expected":["1.20",["Rounded"]],"passed":false},{"actual":["1.20",[]],"check":"already exact","expected":["1.20",[]],"passed":true},{"actual":["123.45",[]],"check":"one excess digit","expected":["NaN",["InvalidOperation"]],"passed":false},{"actual":["12345.67",[]],"check":"coefficient too large","expected":["NaN",["InvalidOperation"]],"passed":false},{"actual":["1E-10",[]],"check":"subnormal exact","expected":["1E-10",["Subnormal"]],"passed":false},{"actual":["-0.00",[]],"check":"negative zero","expected":["-0.00",["Inexact","Rounded"]],"passed":false},{"actual":["0.00",[]],"check":"positive zero","expected":["0.00",["Inexact","Rounded"]],"passed":false},{"actual":["1.2E+2",[]],"check":"integer quantum","expected":["1.2E+2",["Inexact","Rounded"]],"passed":false},{"actual":["10000000000",[]],"check":"overflow exponent","expected":["NaN",["InvalidOperation"]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tie odd\", \"actual\": [\"1.26\", []], \"expected\": [\"1.26\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"tie even\", \"actual\": [\"1.24\", []], \"expected\": [\"1.24\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"rounded exact\", \"actual\": [\"1.20\", []], \"expected\": [\"1.20\", [\"Rounded\"]], \"passed\": false}, {\"check\": \"already exact\", \"actual\": [\"1.20\", []], \"expected\": [\"1.20\", []], \"passed\": true}, {\"check\": \"one excess digit\", \"actual\": [\"123.45\", []], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": false}, {\"check\": \"coefficient too large\", \"actual\": [\"12345.67\", []], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": false}, {\"check\": \"subnormal exact\", \"actual\": [\"1E-10\", []], \"expected\": [\"1E-10\", [\"Subnormal\"]], \"passed\": false}, {\"check\": \"negative zero\", \"actual\": [\"-0.00\", []], \"expected\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"positive zero\", \"actual\": [\"0.00\", []], \"expected\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"integer quantum\", \"actual\": [\"1.2E+2\", []], \"expected\": [\"1.2E+2\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"overflow exponent\", \"actual\": [\"10000000000\", []], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.621,"exit_code":1,"observations":[{"actual":["1.26",[]],"check":"tie odd","expected":["1.26",["Inexact","Rounded"]],"passed":false},{"actual":["1.24",[]],"check":"tie even","expected":["1.24",["Inexact","Rounded"]],"passed":false},{"actual":["1.20",[]],"check":"rounded exact","expected":["1.20",["Rounded"]],"passed":false},{"actual":["1.20",[]],"check":"already exact","expected":["1.20",[]],"passed":true},{"actual":["123.45",[]],"check":"one excess digit","expected":["NaN",["InvalidOperation"]],"passed":false},{"actual":["12345.67",[]],"check":"coefficient too large","expected":["NaN",["InvalidOperation"]],"passed":false},{"actual":["1E-10",[]],"check":"subnormal exact","expected":["1E-10",["Subnormal"]],"passed":false},{"actual":["-0.00",[]],"check":"negative zero","expected":["-0.00",["Inexact","Rounded"]],"passed":false},{"actual":["0.00",[]],"check":"positive zero","expected":["0.00",["Inexact","Rounded"]],"passed":false},{"actual":["1.2E+2",[]],"check":"integer quantum","expected":["1.2E+2",["Inexact","Rounded"]],"passed":false},{"actual":["10000000000",[]],"check":"overflow exponent","expected":["NaN",["InvalidOperation"]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tie odd\", \"actual\": [\"1.26\", []], \"expected\": [\"1.26\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"tie even\", \"actual\": [\"1.24\", []], \"expected\": [\"1.24\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"rounded exact\", \"actual\": [\"1.20\", []], \"expected\": [\"1.20\", [\"Rounded\"]], \"passed\": false}, {\"check\": \"already exact\", \"actual\": [\"1.20\", []], \"expected\": [\"1.20\", []], \"passed\": true}, {\"check\": \"one excess digit\", \"actual\": [\"123.45\", []], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": false}, {\"check\": \"coefficient too large\", \"actual\": [\"12345.67\", []], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": false}, {\"check\": \"subnormal exact\", \"actual\": [\"1E-10\", []], \"expected\": [\"1E-10\", [\"Subnormal\"]], \"passed\": false}, {\"check\": \"negative zero\", \"actual\": [\"-0.00\", []], \"expected\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"positive zero\", \"actual\": [\"0.00\", []], \"expected\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"integer quantum\", \"actual\": [\"1.2E+2\", []], \"expected\": [\"1.2E+2\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"overflow exponent\", \"actual\": [\"10000000000\", []], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}