{"abstract":"Subtracting one erases a tiny square-root increment.","category":"Floating-point arithmetic","checks":8,"contract":"Evaluate sqrt(1+x)-1 stably for finite x >= -1. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-sqrt1pm1","failed_approach":"The attempted local correction result=math.sqrt(1+x)-1 if abs(x)>1e-20 else x/2 still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-sqrt1pm1-cancellation","id":"FA-16106","implementations":{"attempt":{"sha256":"a70077d56bd3b1997d530d1e3e93db0a3b57d05ac25529345f92a4efefc89b02","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(x):\n    try:\n        if x < -1: return 'domain'\n        if x == -1: return '-1'\n        if x == 0: return render(x)\n        result=math.sqrt(1+x)-1 if abs(x)>1e-20 else x/2\n        return render(result)\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('tiny positive', solve(N*2.0**-60), render(N*2.0**-61))\ncheck('tiny negative', solve(-N*2.0**-60), render(-N*2.0**-61))\ncheck('normal', solve(3.0), \"1\")\ncheck('endpoint', solve(-1.0), \"-1\")\ncheck('domain', solve(-2.0), \"domain\")\ncheck('negative zero', solve(-0.0), \"-0\")\ncheck('positive zero', solve(0.0), \"0\")\ncheck('large', solve(1e300), render(1e150))\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":"1d85a41eec0cc0882d9341b7eef6d1a4e1a7fb347f766f5bc2813ff5dcec7dc3","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(x):\n    try:\n        if x < -1: return 'domain'\n        if x == -1: return '-1'\n        if x == 0: return render(x)\n        result=math.sqrt(1+x)-1\n        return render(result)\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('tiny positive', solve(N*2.0**-60), render(N*2.0**-61))\ncheck('tiny negative', solve(-N*2.0**-60), render(-N*2.0**-61))\ncheck('normal', solve(3.0), \"1\")\ncheck('endpoint', solve(-1.0), \"-1\")\ncheck('domain', solve(-2.0), \"domain\")\ncheck('negative zero', solve(-0.0), \"-0\")\ncheck('positive zero', solve(0.0), \"0\")\ncheck('large', solve(1e300), render(1e150))\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":"b8a95528e63549f4f6ce109bdd8a9d3b31dfad76fa72cd3670fdbcd994108370","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(x):\n    try:\n        if x < -1: return 'domain'\n        if x == -1: return '-1'\n        if x == 0: return render(x)\n        result=x/(math.sqrt(1+x)+1)\n        return render(result)\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('tiny positive', solve(N*2.0**-60), render(N*2.0**-61))\ncheck('tiny negative', solve(-N*2.0**-60), render(-N*2.0**-61))\ncheck('normal', solve(3.0), \"1\")\ncheck('endpoint', solve(-1.0), \"-1\")\ncheck('domain', solve(-2.0), \"domain\")\ncheck('negative zero', solve(-0.0), \"-0\")\ncheck('positive zero', solve(0.0), \"0\")\ncheck('large', solve(1e300), render(1e150))\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-sqrt1pm1-cancellation","generated_at":"2026-09-29T14:39:33.345443+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 result=x/(math.sqrt(1+x)+1).","root_cause":"Subtracting one erases a tiny square-root increment. The faulty expression is result=math.sqrt(1+x)-1.","sha256":"1902279e64dcb8d9d399764b8d03028747c8d90eb89571ff45728087e23446ee","title":"Subtracting one erases a tiny square-root increment · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":39.917,"exit_code":1,"observations":[{"actual":"0","check":"tiny positive","expected":"4.3368086899e-19","passed":false},{"actual":"0","check":"tiny negative","expected":"-4.3368086899e-19","passed":false},{"actual":"1","check":"normal","expected":"1","passed":true},{"actual":"-1","check":"endpoint","expected":"-1","passed":true},{"actual":"domain","check":"domain","expected":"domain","passed":true},{"actual":"-0","check":"negative zero","expected":"-0","passed":true},{"actual":"0","check":"positive zero","expected":"0","passed":true},{"actual":"1e+150","check":"large","expected":"1e+150","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tiny positive\", \"actual\": \"0\", \"expected\": \"4.3368086899e-19\", \"passed\": false}, {\"check\": \"tiny negative\", \"actual\": \"0\", \"expected\": \"-4.3368086899e-19\", \"passed\": false}, {\"check\": \"normal\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"endpoint\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}, {\"check\": \"domain\", \"actual\": \"domain\", \"expected\": \"domain\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"positive zero\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"large\", \"actual\": \"1e+150\", \"expected\": \"1e+150\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.404,"exit_code":1,"observations":[{"actual":"0","check":"tiny positive","expected":"4.3368086899e-19","passed":false},{"actual":"0","check":"tiny negative","expected":"-4.3368086899e-19","passed":false},{"actual":"1","check":"normal","expected":"1","passed":true},{"actual":"-1","check":"endpoint","expected":"-1","passed":true},{"actual":"domain","check":"domain","expected":"domain","passed":true},{"actual":"-0","check":"negative zero","expected":"-0","passed":true},{"actual":"0","check":"positive zero","expected":"0","passed":true},{"actual":"1e+150","check":"large","expected":"1e+150","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tiny positive\", \"actual\": \"0\", \"expected\": \"4.3368086899e-19\", \"passed\": false}, {\"check\": \"tiny negative\", \"actual\": \"0\", \"expected\": \"-4.3368086899e-19\", \"passed\": false}, {\"check\": \"normal\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"endpoint\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}, {\"check\": \"domain\", \"actual\": \"domain\", \"expected\": \"domain\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"positive zero\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"large\", \"actual\": \"1e+150\", \"expected\": \"1e+150\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.809,"exit_code":0,"observations":[{"actual":"4.3368086899e-19","check":"tiny positive","expected":"4.3368086899e-19","passed":true},{"actual":"-4.3368086899e-19","check":"tiny negative","expected":"-4.3368086899e-19","passed":true},{"actual":"1","check":"normal","expected":"1","passed":true},{"actual":"-1","check":"endpoint","expected":"-1","passed":true},{"actual":"domain","check":"domain","expected":"domain","passed":true},{"actual":"-0","check":"negative zero","expected":"-0","passed":true},{"actual":"0","check":"positive zero","expected":"0","passed":true},{"actual":"1e+150","check":"large","expected":"1e+150","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"tiny positive\", \"actual\": \"4.3368086899e-19\", \"expected\": \"4.3368086899e-19\", \"passed\": true}, {\"check\": \"tiny negative\", \"actual\": \"-4.3368086899e-19\", \"expected\": \"-4.3368086899e-19\", \"passed\": true}, {\"check\": \"normal\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"endpoint\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}, {\"check\": \"domain\", \"actual\": \"domain\", \"expected\": \"domain\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"positive zero\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"large\", \"actual\": \"1e+150\", \"expected\": \"1e+150\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}