{"abstract":"Encoder treats frexp mantissa as having a unit leading bit.","category":"Floating-point arithmetic","checks":14,"contract":"Encode finite exactly represented dyadic x into sign/4-bit-exponent/3-bit-fraction toy float with bias 7, gradual underflow, round-to-nearest-even and infinity overflow. Return the unsigned byte. The miniature format is stipulated, not a hardware conformance claim.","contract_signature":"x","evaluation_group":"s3-float-toy8-encode","failed_approach":"The attempted local correction e-=2 still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-toy8-encode-frexp-normalization","id":"FA-16011","implementations":{"attempt":{"sha256":"e5f1abf4987e89c8156b79fdf99b1caa8646f0c8195f213774dcdafd890c61c0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(x):\n    sign=128 if math.copysign(1.0,x)<0 else 0\n    x=abs(x)\n    if x == 0: return sign\n    if x >= 248: return sign|120\n    if x < 2**-6:\n        q=round(x*512)\n        return sign|q\n    m,e=math.frexp(x)\n    e-=2\n    q=round(m*16)\n    if q == 16:\n        q=8\n        e+=1\n    if e>7: return sign|120\n    exponent=e+7\n    fraction=q-8\n    return sign|(exponent<<3)|fraction\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('zero', solve(0.0), 0)\ncheck('negative zero', solve(-0.0), 128)\ncheck('subnormal', solve(N/512), N)\ncheck('negative subnormal', solve(-N/512), 128|N)\ncheck('underflow tie', solve(1/1024), 0)\ncheck('subnormal carry', solve(15/1024), 8)\ncheck('normal varying', solve(2.0**N), (N+7)<<3)\ncheck('normal fraction', solve((8+N)/8), 56+N)\ncheck('binade carry', solve(1.9375), 64)\ncheck('below midpoint', solve(1.90625), 63)\ncheck('largest finite', solve(240.0), 119)\ncheck('overflow tie', solve(248.0), 120)\ncheck('negative overflow', solve(-256.0), 248)\ncheck('minimum normal', solve(1/64), 8)\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":"f72c07396600be6ce57d158cbb4157e4610d918be7ef7cc6e8b5f5c634043d89","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(x):\n    sign=128 if math.copysign(1.0,x)<0 else 0\n    x=abs(x)\n    if x == 0: return sign\n    if x >= 248: return sign|120\n    if x < 2**-6:\n        q=round(x*512)\n        return sign|q\n    m,e=math.frexp(x)\n    e+=0\n    q=round(m*16)\n    if q == 16:\n        q=8\n        e+=1\n    if e>7: return sign|120\n    exponent=e+7\n    fraction=q-8\n    return sign|(exponent<<3)|fraction\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('zero', solve(0.0), 0)\ncheck('negative zero', solve(-0.0), 128)\ncheck('subnormal', solve(N/512), N)\ncheck('negative subnormal', solve(-N/512), 128|N)\ncheck('underflow tie', solve(1/1024), 0)\ncheck('subnormal carry', solve(15/1024), 8)\ncheck('normal varying', solve(2.0**N), (N+7)<<3)\ncheck('normal fraction', solve((8+N)/8), 56+N)\ncheck('binade carry', solve(1.9375), 64)\ncheck('below midpoint', solve(1.90625), 63)\ncheck('largest finite', solve(240.0), 119)\ncheck('overflow tie', solve(248.0), 120)\ncheck('negative overflow', solve(-256.0), 248)\ncheck('minimum normal', solve(1/64), 8)\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-toy8-encode-frexp-normalization","generated_at":"2026-09-29T14:39:32.729985+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":"Encoder treats frexp mantissa as having a unit leading bit. The faulty expression is e+=0.","sha256":"7a819c4814d878496355502fd3053c4b4e72aff872c8b643a14b66399380fbda","title":"Encoder treats frexp mantissa as having a unit leading bit · 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":41.903,"exit_code":1,"observations":[{"actual":0,"check":"zero","expected":0,"passed":true},{"actual":128,"check":"negative zero","expected":128,"passed":true},{"actual":1,"check":"subnormal","expected":1,"passed":true},{"actual":129,"check":"negative subnormal","expected":129,"passed":true},{"actual":0,"check":"underflow tie","expected":0,"passed":true},{"actual":8,"check":"subnormal carry","expected":8,"passed":true},{"actual":56,"check":"normal varying","expected":64,"passed":false},{"actual":49,"check":"normal fraction","expected":57,"passed":false},{"actual":56,"check":"binade carry","expected":64,"passed":false},{"actual":55,"check":"below midpoint","expected":63,"passed":false},{"actual":111,"check":"largest finite","expected":119,"passed":false},{"actual":120,"check":"overflow tie","expected":120,"passed":true},{"actual":248,"check":"negative overflow","expected":248,"passed":true},{"actual":0,"check":"minimum normal","expected":8,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"zero\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"negative zero\", \"actual\": 128, \"expected\": 128, \"passed\": true}, {\"check\": \"subnormal\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"negative subnormal\", \"actual\": 129, \"expected\": 129, \"passed\": true}, {\"check\": \"underflow tie\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"subnormal carry\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"normal varying\", \"actual\": 56, \"expected\": 64, \"passed\": false}, {\"check\": \"normal fraction\", \"actual\": 49, \"expected\": 57, \"passed\": false}, {\"check\": \"binade carry\", \"actual\": 56, \"expected\": 64, \"passed\": false}, {\"check\": \"below midpoint\", \"actual\": 55, \"expected\": 63, \"passed\": false}, {\"check\": \"largest finite\", \"actual\": 111, \"expected\": 119, \"passed\": false}, {\"check\": \"overflow tie\", \"actual\": 120, \"expected\": 120, \"passed\": true}, {\"check\": \"negative overflow\", \"actual\": 248, \"expected\": 248, \"passed\": true}, {\"check\": \"minimum normal\", \"actual\": 0, \"expected\": 8, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":37.689,"exit_code":1,"observations":[{"actual":0,"check":"zero","expected":0,"passed":true},{"actual":128,"check":"negative zero","expected":128,"passed":true},{"actual":1,"check":"subnormal","expected":1,"passed":true},{"actual":129,"check":"negative subnormal","expected":129,"passed":true},{"actual":0,"check":"underflow tie","expected":0,"passed":true},{"actual":8,"check":"subnormal carry","expected":8,"passed":true},{"actual":72,"check":"normal varying","expected":64,"passed":false},{"actual":65,"check":"normal fraction","expected":57,"passed":false},{"actual":72,"check":"binade carry","expected":64,"passed":false},{"actual":71,"check":"below midpoint","expected":63,"passed":false},{"actual":120,"check":"largest finite","expected":119,"passed":false},{"actual":120,"check":"overflow tie","expected":120,"passed":true},{"actual":248,"check":"negative overflow","expected":248,"passed":true},{"actual":16,"check":"minimum normal","expected":8,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"zero\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"negative zero\", \"actual\": 128, \"expected\": 128, \"passed\": true}, {\"check\": \"subnormal\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"negative subnormal\", \"actual\": 129, \"expected\": 129, \"passed\": true}, {\"check\": \"underflow tie\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"subnormal carry\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"normal varying\", \"actual\": 72, \"expected\": 64, \"passed\": false}, {\"check\": \"normal fraction\", \"actual\": 65, \"expected\": 57, \"passed\": false}, {\"check\": \"binade carry\", \"actual\": 72, \"expected\": 64, \"passed\": false}, {\"check\": \"below midpoint\", \"actual\": 71, \"expected\": 63, \"passed\": false}, {\"check\": \"largest finite\", \"actual\": 120, \"expected\": 119, \"passed\": false}, {\"check\": \"overflow tie\", \"actual\": 120, \"expected\": 120, \"passed\": true}, {\"check\": \"negative overflow\", \"actual\": 248, \"expected\": 248, \"passed\": true}, {\"check\": \"minimum normal\", \"actual\": 16, \"expected\": 8, \"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."}}