{"abstract":"Decimal notation derives sign from comparison with zero.","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.","evaluation_group":"s3-float-decimal-notation","failed_approach":"The attempted local correction prefix=\"\" still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-decimal-notation-coefficient-sign","id":"FA-17156","implementations":{"attempt":{"sha256":"90aac832661c657d68c8f9e20ef269ecbc56c432d281a2f2ab6dcd5a91f3422a","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=ctx.create_decimal(text)\n    sign,digits,exponent=value.as_tuple()\n    prefix=\"\"\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":"08625b78d669ba5d32dc2fa0949823c563009f30ce2e136816f284d6b983eac4","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=ctx.create_decimal(text)\n    sign,digits,exponent=value.as_tuple()\n    prefix=\"-\" if value<0 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"},"fixed":{"sha256":"c421a992a6fd42590fcb32069f1fa06ed719cb80eba3fc3f3045dd9c8cb32870","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=ctx.create_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-coefficient-sign","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.","repair":"Apply the contract at this fault site using prefix='-' if sign else ''.","root_cause":"Decimal notation derives sign from comparison with zero. The faulty expression is prefix=\"-\" if value<0 else \"\".","sha256":"1d9dbcbe4d5f1daa1a48a212c41d66da82102f772d32db59d7307f589728f0d2","title":"Decimal notation derives sign from comparison with zero · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":46.461,"exit_code":1,"observations":[{"actual":"1.00e3","check":"scientific carry","expected":"1.00e3","passed":true},{"actual":"1.00e3","check":"engineering carry","expected":"1.00e3","passed":true},{"actual":"12.3e3","check":"two integer digits","expected":"12.3e3","passed":true},{"actual":"123e3","check":"three integer digits","expected":"123e3","passed":true},{"actual":"12.3e-3","check":"negative exponent","expected":"12.3e-3","passed":true},{"actual":"1.23e-2","check":"scientific small","expected":"1.23e-2","passed":true},{"actual":"100e0","check":"padding","expected":"100e0","passed":true},{"actual":"1.23e4","check":"negative coefficient","expected":"-1.23e4","passed":false},{"actual":"0e0","check":"negative zero","expected":"-0e0","passed":false},{"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\": \"1.00e3\", \"expected\": \"1.00e3\", \"passed\": true}, {\"check\": \"engineering carry\", \"actual\": \"1.00e3\", \"expected\": \"1.00e3\", \"passed\": true}, {\"check\": \"two integer digits\", \"actual\": \"12.3e3\", \"expected\": \"12.3e3\", \"passed\": true}, {\"check\": \"three integer digits\", \"actual\": \"123e3\", \"expected\": \"123e3\", \"passed\": true}, {\"check\": \"negative exponent\", \"actual\": \"12.3e-3\", \"expected\": \"12.3e-3\", \"passed\": true}, {\"check\": \"scientific small\", \"actual\": \"1.23e-2\", \"expected\": \"1.23e-2\", \"passed\": true}, {\"check\": \"padding\", \"actual\": \"100e0\", \"expected\": \"100e0\", \"passed\": true}, {\"check\": \"negative coefficient\", \"actual\": \"1.23e4\", \"expected\": \"-1.23e4\", \"passed\": false}, {\"check\": \"negative zero\", \"actual\": \"0e0\", \"expected\": \"-0e0\", \"passed\": false}, {\"check\": \"positive zero\", \"actual\": \"0e0\", \"expected\": \"0e0\", \"passed\": true}, {\"check\": \"retained zeros\", \"actual\": \"1.200e0\", \"expected\": \"1.200e0\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.954,"exit_code":1,"observations":[{"actual":"1.00e3","check":"scientific carry","expected":"1.00e3","passed":true},{"actual":"1.00e3","check":"engineering carry","expected":"1.00e3","passed":true},{"actual":"12.3e3","check":"two integer digits","expected":"12.3e3","passed":true},{"actual":"123e3","check":"three integer digits","expected":"123e3","passed":true},{"actual":"12.3e-3","check":"negative exponent","expected":"12.3e-3","passed":true},{"actual":"1.23e-2","check":"scientific small","expected":"1.23e-2","passed":true},{"actual":"100e0","check":"padding","expected":"100e0","passed":true},{"actual":"-1.23e4","check":"negative coefficient","expected":"-1.23e4","passed":true},{"actual":"0e0","check":"negative zero","expected":"-0e0","passed":false},{"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\": \"1.00e3\", \"expected\": \"1.00e3\", \"passed\": true}, {\"check\": \"engineering carry\", \"actual\": \"1.00e3\", \"expected\": \"1.00e3\", \"passed\": true}, {\"check\": \"two integer digits\", \"actual\": \"12.3e3\", \"expected\": \"12.3e3\", \"passed\": true}, {\"check\": \"three integer digits\", \"actual\": \"123e3\", \"expected\": \"123e3\", \"passed\": true}, {\"check\": \"negative exponent\", \"actual\": \"12.3e-3\", \"expected\": \"12.3e-3\", \"passed\": true}, {\"check\": \"scientific small\", \"actual\": \"1.23e-2\", \"expected\": \"1.23e-2\", \"passed\": true}, {\"check\": \"padding\", \"actual\": \"100e0\", \"expected\": \"100e0\", \"passed\": true}, {\"check\": \"negative coefficient\", \"actual\": \"-1.23e4\", \"expected\": \"-1.23e4\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"0e0\", \"expected\": \"-0e0\", \"passed\": false}, {\"check\": \"positive zero\", \"actual\": \"0e0\", \"expected\": \"0e0\", \"passed\": true}, {\"check\": \"retained zeros\", \"actual\": \"1.200e0\", \"expected\": \"1.200e0\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":47.401,"exit_code":0,"observations":[{"actual":"1.00e3","check":"scientific carry","expected":"1.00e3","passed":true},{"actual":"1.00e3","check":"engineering carry","expected":"1.00e3","passed":true},{"actual":"12.3e3","check":"two integer digits","expected":"12.3e3","passed":true},{"actual":"123e3","check":"three integer digits","expected":"123e3","passed":true},{"actual":"12.3e-3","check":"negative exponent","expected":"12.3e-3","passed":true},{"actual":"1.23e-2","check":"scientific small","expected":"1.23e-2","passed":true},{"actual":"100e0","check":"padding","expected":"100e0","passed":true},{"actual":"-1.23e4","check":"negative coefficient","expected":"-1.23e4","passed":true},{"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":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"scientific carry\", \"actual\": \"1.00e3\", \"expected\": \"1.00e3\", \"passed\": true}, {\"check\": \"engineering carry\", \"actual\": \"1.00e3\", \"expected\": \"1.00e3\", \"passed\": true}, {\"check\": \"two integer digits\", \"actual\": \"12.3e3\", \"expected\": \"12.3e3\", \"passed\": true}, {\"check\": \"three integer digits\", \"actual\": \"123e3\", \"expected\": \"123e3\", \"passed\": true}, {\"check\": \"negative exponent\", \"actual\": \"12.3e-3\", \"expected\": \"12.3e-3\", \"passed\": true}, {\"check\": \"scientific small\", \"actual\": \"1.23e-2\", \"expected\": \"1.23e-2\", \"passed\": true}, {\"check\": \"padding\", \"actual\": \"100e0\", \"expected\": \"100e0\", \"passed\": true}, {\"check\": \"negative coefficient\", \"actual\": \"-1.23e4\", \"expected\": \"-1.23e4\", \"passed\": true}, {\"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\": true}\n"}},"verified":true,"visibility":"public"}