{"abstract":"Decimal quantization strips zeros required by the requested quantum.","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 return [str(result.normalize()) if result.is_finite() else str(result),flags] still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-decimal-quantum-target-normalization","id":"FA-16901","implementations":{"attempt":{"sha256":"3b956d47d3c36698be4674b977455dada02d9c6252d8022d60177baea00ec26b","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.normalize()) if result.is_finite() else 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":"d6a06727a13ff49e61e303655a902ae4713db8fd839cf5e0a4b6b5b58d3fe49f","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.normalize()),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-target-normalization","generated_at":"2026-09-29T14:39:40.974307+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 return [str(result),flags].","root_cause":"Decimal quantization strips zeros required by the requested quantum. The faulty expression is return [str(result.normalize()),flags].","sha256":"d9c2b24c44e48a6b3b6e239248ffc63dc5053b517eb3560603fc20853dfcb944","title":"Decimal quantization strips zeros required by the requested quantum · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.449,"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.2",["Rounded"]],"check":"rounded exact","expected":["1.20",["Rounded"]],"passed":false},{"actual":["1.2",[]],"check":"already exact","expected":["1.20",[]],"passed":false},{"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",["Inexact","Rounded"]],"check":"negative zero","expected":["-0.00",["Inexact","Rounded"]],"passed":false},{"actual":["0",["Inexact","Rounded"]],"check":"positive zero","expected":["0.00",["Inexact","Rounded"]],"passed":false},{"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.2\", [\"Rounded\"]], \"expected\": [\"1.20\", [\"Rounded\"]], \"passed\": false}, {\"check\": \"already exact\", \"actual\": [\"1.2\", []], \"expected\": [\"1.20\", []], \"passed\": false}, {\"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\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"positive zero\", \"actual\": [\"0\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"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":42.227,"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.2",["Rounded"]],"check":"rounded exact","expected":["1.20",["Rounded"]],"passed":false},{"actual":["1.2",[]],"check":"already exact","expected":["1.20",[]],"passed":false},{"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",["Inexact","Rounded"]],"check":"negative zero","expected":["-0.00",["Inexact","Rounded"]],"passed":false},{"actual":["0",["Inexact","Rounded"]],"check":"positive zero","expected":["0.00",["Inexact","Rounded"]],"passed":false},{"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.2\", [\"Rounded\"]], \"expected\": [\"1.20\", [\"Rounded\"]], \"passed\": false}, {\"check\": \"already exact\", \"actual\": [\"1.2\", []], \"expected\": [\"1.20\", []], \"passed\": false}, {\"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\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"-0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"check\": \"positive zero\", \"actual\": [\"0\", [\"Inexact\", \"Rounded\"]], \"expected\": [\"0.00\", [\"Inexact\", \"Rounded\"]], \"passed\": false}, {\"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.369,"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"}