{"abstract":"Decimal notation lays out unrounded coefficient digits.","category":"Floating-point arithmetic","checks":11,"contract":"Render a finite decimal text after half-even rounding to precision, in scientific or engineering notation. Preserve coefficient trailing zeros; engineering exponent is a multiple of three with one to three integer digits. Zero is canonical coefficient zero with original sign and exponent zero.","contract_signature":"text,precision,engineering","evaluation_group":"s3-float-decimal-notation","failed_approach":"The attempted local correction value=Decimal(str(float(text))) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-decimal-notation-precision-before-layout","id":"FA-17116","implementations":{"attempt":{"sha256":"b023cf55abb024d82f30e0e9cfc7aebe889195914571459702e171fad4988903","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,precision,engineering):\n    ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN)\n    value=Decimal(str(float(text)))\n    sign,digits,exponent=value.as_tuple()\n    prefix='-' if sign else ''\n    if value.is_zero(): return prefix+'0e0'\n    coefficient=''.join(str(d) for d in digits)\n    adjusted=len(coefficient)+exponent-1\n    scale=(adjusted//3)*3 if engineering else adjusted\n    leading=adjusted-scale+1\n    coefficient=coefficient.ljust(leading,'0')\n    mantissa=coefficient[:leading]\n    if len(coefficient)>leading: mantissa+='.'+coefficient[leading:]\n    return prefix+mantissa+'e'+str(scale)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('scientific carry', solve(\"999.5\",3,False), \"1.00e3\")\ncheck('engineering carry', solve(\"999.5\",3,True), \"1.00e3\")\ncheck('two integer digits', solve(\"12345\",3,True), \"12.3e3\")\ncheck('three integer digits', solve(\"123456\",3,True), \"123e3\")\ncheck('negative exponent', solve(\"0.01234\",3,True), \"12.3e-3\")\ncheck('scientific small', solve(\"0.01234\",3,False), \"1.23e-2\")\ncheck('padding', solve(str(N)+\"e2\",3,True), str(N)+\"00e0\")\ncheck('negative coefficient', solve(\"-12345\",3,False), \"-1.23e4\")\ncheck('negative zero', solve(\"-0.00\",3,False), \"-0e0\")\ncheck('positive zero', solve(\"0.00\",3,True), \"0e0\")\ncheck('retained zeros', solve(\"1.200\",4,False), \"1.200e0\")\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":"69d9d86341ba2cc4d04e850e7873f01a79d4ae0bb458db7d5e4953dfe4c91311","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,precision,engineering):\n    ctx=Context(prec=precision,rounding=ROUND_HALF_EVEN)\n    value=Decimal(text)\n    sign,digits,exponent=value.as_tuple()\n    prefix='-' if sign else ''\n    if value.is_zero(): return prefix+'0e0'\n    coefficient=''.join(str(d) for d in digits)\n    adjusted=len(coefficient)+exponent-1\n    scale=(adjusted//3)*3 if engineering else adjusted\n    leading=adjusted-scale+1\n    coefficient=coefficient.ljust(leading,'0')\n    mantissa=coefficient[:leading]\n    if len(coefficient)>leading: mantissa+='.'+coefficient[leading:]\n    return prefix+mantissa+'e'+str(scale)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('scientific carry', solve(\"999.5\",3,False), \"1.00e3\")\ncheck('engineering carry', solve(\"999.5\",3,True), \"1.00e3\")\ncheck('two integer digits', solve(\"12345\",3,True), \"12.3e3\")\ncheck('three integer digits', solve(\"123456\",3,True), \"123e3\")\ncheck('negative exponent', solve(\"0.01234\",3,True), \"12.3e-3\")\ncheck('scientific small', solve(\"0.01234\",3,False), \"1.23e-2\")\ncheck('padding', solve(str(N)+\"e2\",3,True), str(N)+\"00e0\")\ncheck('negative coefficient', solve(\"-12345\",3,False), \"-1.23e4\")\ncheck('negative zero', solve(\"-0.00\",3,False), \"-0e0\")\ncheck('positive zero', solve(\"0.00\",3,True), \"0e0\")\ncheck('retained zeros', solve(\"1.200\",4,False), \"1.200e0\")\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-notation-precision-before-layout","generated_at":"2026-09-29T14:39:43.672358+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 notation lays out unrounded coefficient digits. The faulty expression is value=Decimal(text).","sha256":"54dd6763b7c027b22b39ba4a848cd3fea0fa0cc45ec09f28fc4916dbe21a3d41","title":"Decimal notation lays out unrounded coefficient digits · 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":47.719,"exit_code":1,"observations":[{"actual":"9.995e2","check":"scientific carry","expected":"1.00e3","passed":false},{"actual":"999.5e0","check":"engineering carry","expected":"1.00e3","passed":false},{"actual":"12.3450e3","check":"two integer digits","expected":"12.3e3","passed":false},{"actual":"123.4560e3","check":"three integer digits","expected":"123e3","passed":false},{"actual":"12.34e-3","check":"negative exponent","expected":"12.3e-3","passed":false},{"actual":"1.234e-2","check":"scientific small","expected":"1.23e-2","passed":false},{"actual":"100.0e0","check":"padding","expected":"100e0","passed":false},{"actual":"-1.23450e4","check":"negative coefficient","expected":"-1.23e4","passed":false},{"actual":"-0e0","check":"negative zero","expected":"-0e0","passed":true},{"actual":"0e0","check":"positive zero","expected":"0e0","passed":true},{"actual":"1.2e0","check":"retained zeros","expected":"1.200e0","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"scientific carry\", \"actual\": \"9.995e2\", \"expected\": \"1.00e3\", \"passed\": false}, {\"check\": \"engineering carry\", \"actual\": \"999.5e0\", \"expected\": \"1.00e3\", \"passed\": false}, {\"check\": \"two integer digits\", \"actual\": \"12.3450e3\", \"expected\": \"12.3e3\", \"passed\": false}, {\"check\": \"three integer digits\", \"actual\": \"123.4560e3\", \"expected\": \"123e3\", \"passed\": false}, {\"check\": \"negative exponent\", \"actual\": \"12.34e-3\", \"expected\": \"12.3e-3\", \"passed\": false}, {\"check\": \"scientific small\", \"actual\": \"1.234e-2\", \"expected\": \"1.23e-2\", \"passed\": false}, {\"check\": \"padding\", \"actual\": \"100.0e0\", \"expected\": \"100e0\", \"passed\": false}, {\"check\": \"negative coefficient\", \"actual\": \"-1.23450e4\", \"expected\": \"-1.23e4\", \"passed\": false}, {\"check\": \"negative zero\", \"actual\": \"-0e0\", \"expected\": \"-0e0\", \"passed\": true}, {\"check\": \"positive zero\", \"actual\": \"0e0\", \"expected\": \"0e0\", \"passed\": true}, {\"check\": \"retained zeros\", \"actual\": \"1.2e0\", \"expected\": \"1.200e0\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":46.644,"exit_code":1,"observations":[{"actual":"9.995e2","check":"scientific carry","expected":"1.00e3","passed":false},{"actual":"999.5e0","check":"engineering carry","expected":"1.00e3","passed":false},{"actual":"12.345e3","check":"two integer digits","expected":"12.3e3","passed":false},{"actual":"123.456e3","check":"three integer digits","expected":"123e3","passed":false},{"actual":"12.34e-3","check":"negative exponent","expected":"12.3e-3","passed":false},{"actual":"1.234e-2","check":"scientific small","expected":"1.23e-2","passed":false},{"actual":"100e0","check":"padding","expected":"100e0","passed":true},{"actual":"-1.2345e4","check":"negative coefficient","expected":"-1.23e4","passed":false},{"actual":"-0e0","check":"negative zero","expected":"-0e0","passed":true},{"actual":"0e0","check":"positive zero","expected":"0e0","passed":true},{"actual":"1.200e0","check":"retained zeros","expected":"1.200e0","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"scientific carry\", \"actual\": \"9.995e2\", \"expected\": \"1.00e3\", \"passed\": false}, {\"check\": \"engineering carry\", \"actual\": \"999.5e0\", \"expected\": \"1.00e3\", \"passed\": false}, {\"check\": \"two integer digits\", \"actual\": \"12.345e3\", \"expected\": \"12.3e3\", \"passed\": false}, {\"check\": \"three integer digits\", \"actual\": \"123.456e3\", \"expected\": \"123e3\", \"passed\": false}, {\"check\": \"negative exponent\", \"actual\": \"12.34e-3\", \"expected\": \"12.3e-3\", \"passed\": false}, {\"check\": \"scientific small\", \"actual\": \"1.234e-2\", \"expected\": \"1.23e-2\", \"passed\": false}, {\"check\": \"padding\", \"actual\": \"100e0\", \"expected\": \"100e0\", \"passed\": true}, {\"check\": \"negative coefficient\", \"actual\": \"-1.2345e4\", \"expected\": \"-1.23e4\", \"passed\": false}, {\"check\": \"negative zero\", \"actual\": \"-0e0\", \"expected\": \"-0e0\", \"passed\": true}, {\"check\": \"positive zero\", \"actual\": \"0e0\", \"expected\": \"0e0\", \"passed\": true}, {\"check\": \"retained zeros\", \"actual\": \"1.200e0\", \"expected\": \"1.200e0\", \"passed\": true}], \"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."}}