{"abstract":"Log ratio accepts zero endpoints as ordinary positives.","category":"Floating-point arithmetic","checks":8,"contract":"Evaluate log(a/b) for positive finite endpoints without overflowing an intermediate quotient and without cancellation for nearby operands. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-log-ratio","failed_approach":"The attempted local correction if a<=0 or b<=0: return '-infinity' still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-log-ratio-ratio-domain","id":"FA-17051","implementations":{"attempt":{"sha256":"9add15ff384c78abf4a45cf44c3a120383d88778893272045e49b61a2dfc31b1","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):\n    try:\n        if a<=0 or b<=0: return '-infinity'\n        if a==b: return '0'\n        r=(a-b)/b\n        if abs(r)<0.5:\n            result=math.log1p(r)\n        else:\n            result=math.log(a)-math.log(b)\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('overflowing quotient', solve(N*1e300,1e-300), render(math.log(N*1e300)-math.log(1e-300)))\ncheck('underflowing quotient', solve(1e-300,N*1e300), render(math.log(1e-300)-math.log(N*1e300)))\ncheck('nearby moderate', solve(1.125,1.0), render(math.log(1.125)))\ncheck('nearby large', solve(math.nextafter(1e100,math.inf),1e100), render(math.log1p((math.nextafter(1e100,math.inf)-1e100)/1e100)))\ncheck('normal', solve(float(N+1),1.0), render(math.log(N+1)))\ncheck('reverse', solve(1.0,float(N+1)), render(-math.log(N+1)))\ncheck('equal', solve(float(N),float(N)), \"0\")\ncheck('invalid', solve(0.0,float(N)), \"domain\")\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":"2532d81984d87f8006ade55349b0fe9ec622040e8ce94233048d46c3a23393df","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):\n    try:\n        if a<0 or b<0: return 'domain'\n        if a==b: return '0'\n        r=(a-b)/b\n        if abs(r)<0.5:\n            result=math.log1p(r)\n        else:\n            result=math.log(a)-math.log(b)\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('overflowing quotient', solve(N*1e300,1e-300), render(math.log(N*1e300)-math.log(1e-300)))\ncheck('underflowing quotient', solve(1e-300,N*1e300), render(math.log(1e-300)-math.log(N*1e300)))\ncheck('nearby moderate', solve(1.125,1.0), render(math.log(1.125)))\ncheck('nearby large', solve(math.nextafter(1e100,math.inf),1e100), render(math.log1p((math.nextafter(1e100,math.inf)-1e100)/1e100)))\ncheck('normal', solve(float(N+1),1.0), render(math.log(N+1)))\ncheck('reverse', solve(1.0,float(N+1)), render(-math.log(N+1)))\ncheck('equal', solve(float(N),float(N)), \"0\")\ncheck('invalid', solve(0.0,float(N)), \"domain\")\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":"7da1be31e2ee6da6c7190c7986b0341a1ff43375807b435544d6a8b7467aa487","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):\n    try:\n        if a<=0 or b<=0: return 'domain'\n        if a==b: return '0'\n        r=(a-b)/b\n        if abs(r)<0.5:\n            result=math.log1p(r)\n        else:\n            result=math.log(a)-math.log(b)\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('overflowing quotient', solve(N*1e300,1e-300), render(math.log(N*1e300)-math.log(1e-300)))\ncheck('underflowing quotient', solve(1e-300,N*1e300), render(math.log(1e-300)-math.log(N*1e300)))\ncheck('nearby moderate', solve(1.125,1.0), render(math.log(1.125)))\ncheck('nearby large', solve(math.nextafter(1e100,math.inf),1e100), render(math.log1p((math.nextafter(1e100,math.inf)-1e100)/1e100)))\ncheck('normal', solve(float(N+1),1.0), render(math.log(N+1)))\ncheck('reverse', solve(1.0,float(N+1)), render(-math.log(N+1)))\ncheck('equal', solve(float(N),float(N)), \"0\")\ncheck('invalid', solve(0.0,float(N)), \"domain\")\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-log-ratio-ratio-domain","generated_at":"2026-09-29T14:39:42.354580+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 if a<=0 or b<=0: return 'domain'.","root_cause":"Log ratio accepts zero endpoints as ordinary positives. The faulty expression is if a<0 or b<0: return 'domain'.","sha256":"bc9271fffcd08f7e957387701b389ab58a79d71f7108d49333fd661f76640e50","title":"Log ratio accepts zero endpoints as ordinary positives · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.059,"exit_code":1,"observations":[{"actual":"1381.5510558","check":"overflowing quotient","expected":"1381.5510558","passed":true},{"actual":"-1381.5510558","check":"underflowing quotient","expected":"-1381.5510558","passed":true},{"actual":"0.11778303566","check":"nearby moderate","expected":"0.11778303566","passed":true},{"actual":"1.9426688922e-16","check":"nearby large","expected":"1.9426688922e-16","passed":true},{"actual":"0.69314718056","check":"normal","expected":"0.69314718056","passed":true},{"actual":"-0.69314718056","check":"reverse","expected":"-0.69314718056","passed":true},{"actual":"0","check":"equal","expected":"0","passed":true},{"actual":"-infinity","check":"invalid","expected":"domain","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"overflowing quotient\", \"actual\": \"1381.5510558\", \"expected\": \"1381.5510558\", \"passed\": true}, {\"check\": \"underflowing quotient\", \"actual\": \"-1381.5510558\", \"expected\": \"-1381.5510558\", \"passed\": true}, {\"check\": \"nearby moderate\", \"actual\": \"0.11778303566\", \"expected\": \"0.11778303566\", \"passed\": true}, {\"check\": \"nearby large\", \"actual\": \"1.9426688922e-16\", \"expected\": \"1.9426688922e-16\", \"passed\": true}, {\"check\": \"normal\", \"actual\": \"0.69314718056\", \"expected\": \"0.69314718056\", \"passed\": true}, {\"check\": \"reverse\", \"actual\": \"-0.69314718056\", \"expected\": \"-0.69314718056\", \"passed\": true}, {\"check\": \"equal\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"invalid\", \"actual\": \"-infinity\", \"expected\": \"domain\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.793,"exit_code":1,"observations":[{"actual":"1381.5510558","check":"overflowing quotient","expected":"1381.5510558","passed":true},{"actual":"-1381.5510558","check":"underflowing quotient","expected":"-1381.5510558","passed":true},{"actual":"0.11778303566","check":"nearby moderate","expected":"0.11778303566","passed":true},{"actual":"1.9426688922e-16","check":"nearby large","expected":"1.9426688922e-16","passed":true},{"actual":"0.69314718056","check":"normal","expected":"0.69314718056","passed":true},{"actual":"-0.69314718056","check":"reverse","expected":"-0.69314718056","passed":true},{"actual":"0","check":"equal","expected":"0","passed":true},{"actual":"arithmetic-error","check":"invalid","expected":"domain","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"overflowing quotient\", \"actual\": \"1381.5510558\", \"expected\": \"1381.5510558\", \"passed\": true}, {\"check\": \"underflowing quotient\", \"actual\": \"-1381.5510558\", \"expected\": \"-1381.5510558\", \"passed\": true}, {\"check\": \"nearby moderate\", \"actual\": \"0.11778303566\", \"expected\": \"0.11778303566\", \"passed\": true}, {\"check\": \"nearby large\", \"actual\": \"1.9426688922e-16\", \"expected\": \"1.9426688922e-16\", \"passed\": true}, {\"check\": \"normal\", \"actual\": \"0.69314718056\", \"expected\": \"0.69314718056\", \"passed\": true}, {\"check\": \"reverse\", \"actual\": \"-0.69314718056\", \"expected\": \"-0.69314718056\", \"passed\": true}, {\"check\": \"equal\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"invalid\", \"actual\": \"arithmetic-error\", \"expected\": \"domain\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.656,"exit_code":0,"observations":[{"actual":"1381.5510558","check":"overflowing quotient","expected":"1381.5510558","passed":true},{"actual":"-1381.5510558","check":"underflowing quotient","expected":"-1381.5510558","passed":true},{"actual":"0.11778303566","check":"nearby moderate","expected":"0.11778303566","passed":true},{"actual":"1.9426688922e-16","check":"nearby large","expected":"1.9426688922e-16","passed":true},{"actual":"0.69314718056","check":"normal","expected":"0.69314718056","passed":true},{"actual":"-0.69314718056","check":"reverse","expected":"-0.69314718056","passed":true},{"actual":"0","check":"equal","expected":"0","passed":true},{"actual":"domain","check":"invalid","expected":"domain","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"overflowing quotient\", \"actual\": \"1381.5510558\", \"expected\": \"1381.5510558\", \"passed\": true}, {\"check\": \"underflowing quotient\", \"actual\": \"-1381.5510558\", \"expected\": \"-1381.5510558\", \"passed\": true}, {\"check\": \"nearby moderate\", \"actual\": \"0.11778303566\", \"expected\": \"0.11778303566\", \"passed\": true}, {\"check\": \"nearby large\", \"actual\": \"1.9426688922e-16\", \"expected\": \"1.9426688922e-16\", \"passed\": true}, {\"check\": \"normal\", \"actual\": \"0.69314718056\", \"expected\": \"0.69314718056\", \"passed\": true}, {\"check\": \"reverse\", \"actual\": \"-0.69314718056\", \"expected\": \"-0.69314718056\", \"passed\": true}, {\"check\": \"equal\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"invalid\", \"actual\": \"domain\", \"expected\": \"domain\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}