FA-17191 / Floating-point arithmetic / Open access
Cube root discards the residual exponent modulo three · case 01
Cube root discards the residual exponent modulo three.
ROOT CAUSE
Cube root discards the residual exponent modulo three. The faulty expression is root=m**(1/3).
VERIFIED REPAIR
Apply the contract at this fault site using root=(math.ldexp(m,r))**(1/3).
Unsuccessful approach: The attempted local correction root=(m*r)**(1/3) still violates the explicit regression fixtures.
Case contract
Real cube root on finite binary64 inputs. Split magnitude with frexp, divide exponent by three with floor division, and apply residual exponent before rooting. Return signed zero unchanged. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.
Why this case matters
An offline floating representation model isolates a reproducible arithmetic fault.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
if math.isnan(x): return 'nan'
if math.isinf(x): return '-infinity' if x<0 else '+infinity'
return format(x,'.11g')
N = 1
observations = []
def solve(x):
try:
if x==0: return render(x)
m,e=math.frexp(abs(x))
q,r=divmod(e,3)
root=m**(1/3)
result=math.ldexp(root,q)
return render(math.copysign(result,x))
except (ValueError, OverflowError, ZeroDivisionError, TypeError):
return "arithmetic-error"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('integer cube', solve(float(N**3)), render(float(N)))
check('negative cube', solve(-float(N**3)), render(-float(N)))
check('huge', solve(1e300), "1e+100")
check('tiny', solve(1e-300), "1e-100")
check('power remainder', solve(16.0), render(16.0**(1/3)))
check('negative zero', solve(-0.0), "-0")
check('positive zero', solve(0.0), "0")
check('subnormal', solve(math.ldexp(1.0,-1074)), render(math.ldexp(1.0,-358)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| integer cube | 0.79370052598 | 1 | Failed |
| negative cube | -0.79370052598 | -1 | Failed |
| huge | 7.9370052598e+99 | 1e+100 | Failed |
| tiny | 1e-100 | 1e-100 | Passed |
| power remainder | 1.587401052 | 2.5198420998 | Failed |
| negative zero | -0 | -0 | Passed |
| positive zero | 0 | 0 | Passed |
| subnormal | 1.3518179859e-108 | 1.703183936e-108 | Failed |
SHA-256 / 4c8adb56d13e2e3e290bbc18bb56c0c664a69db1eca3292e697d59f9de37b11c
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
if math.isnan(x): return 'nan'
if math.isinf(x): return '-infinity' if x<0 else '+infinity'
return format(x,'.11g')
N = 1
observations = []
def solve(x):
try:
if x==0: return render(x)
m,e=math.frexp(abs(x))
q,r=divmod(e,3)
root=(m*r)**(1/3)
result=math.ldexp(root,q)
return render(math.copysign(result,x))
except (ValueError, OverflowError, ZeroDivisionError, TypeError):
return "arithmetic-error"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('integer cube', solve(float(N**3)), render(float(N)))
check('negative cube', solve(-float(N**3)), render(-float(N)))
check('huge', solve(1e300), "1e+100")
check('tiny', solve(1e-300), "1e-100")
check('power remainder', solve(16.0), render(16.0**(1/3)))
check('negative zero', solve(-0.0), "-0")
check('positive zero', solve(0.0), "0")
check('subnormal', solve(math.ldexp(1.0,-1074)), render(math.ldexp(1.0,-358)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| integer cube | 0.79370052598 | 1 | Failed |
| negative cube | -0.79370052598 | -1 | Failed |
| huge | 7.9370052598e+99 | 1e+100 | Failed |
| tiny | 0 | 1e-100 | Failed |
| power remainder | 2 | 2.5198420998 | Failed |
| negative zero | -0 | -0 | Passed |
| positive zero | 0 | 0 | Passed |
| subnormal | 1.3518179859e-108 | 1.703183936e-108 | Failed |
SHA-256 / bd0c88dad0e63a7fb288eb559f1e889c5d49101ddde871414d7269118b66d972
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
if math.isnan(x): return 'nan'
if math.isinf(x): return '-infinity' if x<0 else '+infinity'
return format(x,'.11g')
N = 1
observations = []
def solve(x):
try:
if x==0: return render(x)
m,e=math.frexp(abs(x))
q,r=divmod(e,3)
root=(math.ldexp(m,r))**(1/3)
result=math.ldexp(root,q)
return render(math.copysign(result,x))
except (ValueError, OverflowError, ZeroDivisionError, TypeError):
return "arithmetic-error"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('integer cube', solve(float(N**3)), render(float(N)))
check('negative cube', solve(-float(N**3)), render(-float(N)))
check('huge', solve(1e300), "1e+100")
check('tiny', solve(1e-300), "1e-100")
check('power remainder', solve(16.0), render(16.0**(1/3)))
check('negative zero', solve(-0.0), "-0")
check('positive zero', solve(0.0), "0")
check('subnormal', solve(math.ldexp(1.0,-1074)), render(math.ldexp(1.0,-358)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| integer cube | 1 | 1 | Passed |
| negative cube | -1 | -1 | Passed |
| huge | 1e+100 | 1e+100 | Passed |
| tiny | 1e-100 | 1e-100 | Passed |
| power remainder | 2.5198420998 | 2.5198420998 | Passed |
| negative zero | -0 | -0 | Passed |
| positive zero | 0 | 0 | Passed |
| subnormal | 1.703183936e-108 | 1.703183936e-108 | Passed |
SHA-256 / 8d1682424e4547465621b0843c39f37c1b286e588de48c5a99019c32d45b41d1
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:39:43.747419+00:00.
Case digest / aac717082b63457d5bb08048928f0ae146436e89a5b5dc3c96700a05ac7440a8