{"abstract":"Decimal quantization discards caller precision.","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+2,rounding=ROUND_HALF_EVEN,Emin=-9,Emax=9) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-decimal-quantum-precision-context","id":"FA-16886","implementations":{"attempt":{"sha256":"34aea7ad53d7223744ff694910c5e2feb7f7aeef31d770f8cab1803bb274ae36","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+2,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"},"broken":{"sha256":"46201cff45d55ca9574da2ff43dfe9e66ec323b1ef237e53ba32dc97b23913ca","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=28,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"},"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-precision-context","generated_at":"2026-09-29T14:39:40.962789+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 discards caller precision. The faulty expression is ctx=Context(prec=28,rounding=ROUND_HALF_EVEN,Emin=-9,Emax=9).","sha256":"7cd6cebd729c1e5293ab28f882170b3f371849e854a3010c4bca1159b7f6c7db","title":"Decimal quantization discards caller precision · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.606,"exit_code":1,"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":["123.45",[]],"check":"one excess digit","expected":["NaN",["InvalidOperation"]],"passed":false},{"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.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\": [\"123.45\", []], \"expected\": [\"NaN\", [\"InvalidOperation\"]], \"passed\": false}, {\"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":44.109,"exit_code":1,"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":["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",["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.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\": [\"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\", [\"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":43.634,"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"}