{"abstract":"Quadratic roots compute the small root by subtraction.","category":"Floating-point arithmetic","checks":9,"contract":"Real roots of a*x*x+b*x+c=0 for finite coefficients with bounded discriminant products. Use sign-aware q to avoid subtractive cancellation and c/q for the complementary root. Return sorted rendered roots, repeated root once, or explicit degenerate/no-real markers. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-quadratic-roots","failed_approach":"The attempted local correction r2=(-b-math.sqrt(d))/(2*a) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-quadratic-roots-root-cancellation","id":"FA-16716","implementations":{"attempt":{"sha256":"d712f33628472a045c3c9c8875d66d888d0c1c4fee909df371a04123268a09b7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(a,b,c):\n    try:\n        if a==0:\n            return [render(-c/b)] if b!=0 else ('all' if c==0 else 'none')\n        d=b*b-4*a*c\n        if d<0: return 'no-real'\n        if d==0: return [render(-b/(2*a))]\n        s=math.sqrt(d)\n        q=-0.5*(b+math.copysign(s,b))\n        r1=q/a\n        r2=(-b-math.sqrt(d))/(2*a)\n        return [render(v) for v in sorted([r1,r2])]\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('large positive b', solve(1.0,1e16*N,1.0), [render(-1e16*N),render(-1/(1e16*N))])\ncheck('large negative b', solve(1.0,-1e16*N,1.0), [render(1/(1e16*N)),render(1e16*N)])\ncheck('normal roots', solve(1.0,-3.0,2.0), [\"1\",\"2\"])\ncheck('repeated', solve(1.0,-2.0*N,float(N*N)), [render(float(N))])\ncheck('linear', solve(0.0,2.0,-2.0*N), [render(float(N))])\ncheck('no real', solve(1.0,0.0,float(N)), \"no-real\")\ncheck('all', solve(0.0,0.0,0.0), \"all\")\ncheck('inconsistent', solve(0.0,0.0,float(N)), \"none\")\ncheck('zero constant', solve(1.0,-float(N),0.0), [\"0\",render(float(N))])\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":"23f633c6f01d903683a206fee7447ba13a3ac05bcf7ba8c9803df3957e431adf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(a,b,c):\n    try:\n        if a==0:\n            return [render(-c/b)] if b!=0 else ('all' if c==0 else 'none')\n        d=b*b-4*a*c\n        if d<0: return 'no-real'\n        if d==0: return [render(-b/(2*a))]\n        s=math.sqrt(d)\n        q=-0.5*(b+math.copysign(s,b))\n        r1=q/a\n        r2=(-b+math.sqrt(d))/(2*a)\n        return [render(v) for v in sorted([r1,r2])]\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('large positive b', solve(1.0,1e16*N,1.0), [render(-1e16*N),render(-1/(1e16*N))])\ncheck('large negative b', solve(1.0,-1e16*N,1.0), [render(1/(1e16*N)),render(1e16*N)])\ncheck('normal roots', solve(1.0,-3.0,2.0), [\"1\",\"2\"])\ncheck('repeated', solve(1.0,-2.0*N,float(N*N)), [render(float(N))])\ncheck('linear', solve(0.0,2.0,-2.0*N), [render(float(N))])\ncheck('no real', solve(1.0,0.0,float(N)), \"no-real\")\ncheck('all', solve(0.0,0.0,0.0), \"all\")\ncheck('inconsistent', solve(0.0,0.0,float(N)), \"none\")\ncheck('zero constant', solve(1.0,-float(N),0.0), [\"0\",render(float(N))])\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":"c821538eaac37cd1b9ec3c4973814f85efffa66e5c2360a75d333aa28d2ff975","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(a,b,c):\n    try:\n        if a==0:\n            return [render(-c/b)] if b!=0 else ('all' if c==0 else 'none')\n        d=b*b-4*a*c\n        if d<0: return 'no-real'\n        if d==0: return [render(-b/(2*a))]\n        s=math.sqrt(d)\n        q=-0.5*(b+math.copysign(s,b))\n        r1=q/a\n        r2=c/q\n        return [render(v) for v in sorted([r1,r2])]\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('large positive b', solve(1.0,1e16*N,1.0), [render(-1e16*N),render(-1/(1e16*N))])\ncheck('large negative b', solve(1.0,-1e16*N,1.0), [render(1/(1e16*N)),render(1e16*N)])\ncheck('normal roots', solve(1.0,-3.0,2.0), [\"1\",\"2\"])\ncheck('repeated', solve(1.0,-2.0*N,float(N*N)), [render(float(N))])\ncheck('linear', solve(0.0,2.0,-2.0*N), [render(float(N))])\ncheck('no real', solve(1.0,0.0,float(N)), \"no-real\")\ncheck('all', solve(0.0,0.0,0.0), \"all\")\ncheck('inconsistent', solve(0.0,0.0,float(N)), \"none\")\ncheck('zero constant', solve(1.0,-float(N),0.0), [\"0\",render(float(N))])\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-quadratic-roots-root-cancellation","generated_at":"2026-09-29T14:39:39.016765+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 r2=c/q.","root_cause":"Quadratic roots compute the small root by subtraction. The faulty expression is r2=(-b+math.sqrt(d))/(2*a).","sha256":"a4609df7f2777b29bff7362307e5e3196684ba577b949fc8c541622366f35859","title":"Quadratic roots compute the small root by subtraction · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.672,"exit_code":1,"observations":[{"actual":["-1e+16","-1e+16"],"check":"large positive b","expected":["-1e+16","-1e-16"],"passed":false},{"actual":["0","1e+16"],"check":"large negative b","expected":["1e-16","1e+16"],"passed":false},{"actual":["1","2"],"check":"normal roots","expected":["1","2"],"passed":true},{"actual":["1"],"check":"repeated","expected":["1"],"passed":true},{"actual":["1"],"check":"linear","expected":["1"],"passed":true},{"actual":"no-real","check":"no real","expected":"no-real","passed":true},{"actual":"all","check":"all","expected":"all","passed":true},{"actual":"none","check":"inconsistent","expected":"none","passed":true},{"actual":["0","1"],"check":"zero constant","expected":["0","1"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"large positive b\", \"actual\": [\"-1e+16\", \"-1e+16\"], \"expected\": [\"-1e+16\", \"-1e-16\"], \"passed\": false}, {\"check\": \"large negative b\", \"actual\": [\"0\", \"1e+16\"], \"expected\": [\"1e-16\", \"1e+16\"], \"passed\": false}, {\"check\": \"normal roots\", \"actual\": [\"1\", \"2\"], \"expected\": [\"1\", \"2\"], \"passed\": true}, {\"check\": \"repeated\", \"actual\": [\"1\"], \"expected\": [\"1\"], \"passed\": true}, {\"check\": \"linear\", \"actual\": [\"1\"], \"expected\": [\"1\"], \"passed\": true}, {\"check\": \"no real\", \"actual\": \"no-real\", \"expected\": \"no-real\", \"passed\": true}, {\"check\": \"all\", \"actual\": \"all\", \"expected\": \"all\", \"passed\": true}, {\"check\": \"inconsistent\", \"actual\": \"none\", \"expected\": \"none\", \"passed\": true}, {\"check\": \"zero constant\", \"actual\": [\"0\", \"1\"], \"expected\": [\"0\", \"1\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.317,"exit_code":1,"observations":[{"actual":["-1e+16","0"],"check":"large positive b","expected":["-1e+16","-1e-16"],"passed":false},{"actual":["1e+16","1e+16"],"check":"large negative b","expected":["1e-16","1e+16"],"passed":false},{"actual":["2","2"],"check":"normal roots","expected":["1","2"],"passed":false},{"actual":["1"],"check":"repeated","expected":["1"],"passed":true},{"actual":["1"],"check":"linear","expected":["1"],"passed":true},{"actual":"no-real","check":"no real","expected":"no-real","passed":true},{"actual":"all","check":"all","expected":"all","passed":true},{"actual":"none","check":"inconsistent","expected":"none","passed":true},{"actual":["1","1"],"check":"zero constant","expected":["0","1"],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"large positive b\", \"actual\": [\"-1e+16\", \"0\"], \"expected\": [\"-1e+16\", \"-1e-16\"], \"passed\": false}, {\"check\": \"large negative b\", \"actual\": [\"1e+16\", \"1e+16\"], \"expected\": [\"1e-16\", \"1e+16\"], \"passed\": false}, {\"check\": \"normal roots\", \"actual\": [\"2\", \"2\"], \"expected\": [\"1\", \"2\"], \"passed\": false}, {\"check\": \"repeated\", \"actual\": [\"1\"], \"expected\": [\"1\"], \"passed\": true}, {\"check\": \"linear\", \"actual\": [\"1\"], \"expected\": [\"1\"], \"passed\": true}, {\"check\": \"no real\", \"actual\": \"no-real\", \"expected\": \"no-real\", \"passed\": true}, {\"check\": \"all\", \"actual\": \"all\", \"expected\": \"all\", \"passed\": true}, {\"check\": \"inconsistent\", \"actual\": \"none\", \"expected\": \"none\", \"passed\": true}, {\"check\": \"zero constant\", \"actual\": [\"1\", \"1\"], \"expected\": [\"0\", \"1\"], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.658,"exit_code":0,"observations":[{"actual":["-1e+16","-1e-16"],"check":"large positive b","expected":["-1e+16","-1e-16"],"passed":true},{"actual":["1e-16","1e+16"],"check":"large negative b","expected":["1e-16","1e+16"],"passed":true},{"actual":["1","2"],"check":"normal roots","expected":["1","2"],"passed":true},{"actual":["1"],"check":"repeated","expected":["1"],"passed":true},{"actual":["1"],"check":"linear","expected":["1"],"passed":true},{"actual":"no-real","check":"no real","expected":"no-real","passed":true},{"actual":"all","check":"all","expected":"all","passed":true},{"actual":"none","check":"inconsistent","expected":"none","passed":true},{"actual":["0","1"],"check":"zero constant","expected":["0","1"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"large positive b\", \"actual\": [\"-1e+16\", \"-1e-16\"], \"expected\": [\"-1e+16\", \"-1e-16\"], \"passed\": true}, {\"check\": \"large negative b\", \"actual\": [\"1e-16\", \"1e+16\"], \"expected\": [\"1e-16\", \"1e+16\"], \"passed\": true}, {\"check\": \"normal roots\", \"actual\": [\"1\", \"2\"], \"expected\": [\"1\", \"2\"], \"passed\": true}, {\"check\": \"repeated\", \"actual\": [\"1\"], \"expected\": [\"1\"], \"passed\": true}, {\"check\": \"linear\", \"actual\": [\"1\"], \"expected\": [\"1\"], \"passed\": true}, {\"check\": \"no real\", \"actual\": \"no-real\", \"expected\": \"no-real\", \"passed\": true}, {\"check\": \"all\", \"actual\": \"all\", \"expected\": \"all\", \"passed\": true}, {\"check\": \"inconsistent\", \"actual\": \"none\", \"expected\": \"none\", \"passed\": true}, {\"check\": \"zero constant\", \"actual\": [\"0\", \"1\"], \"expected\": [\"0\", \"1\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}