FA-16396 / Floating-point arithmetic / Open access
Complex division forgets the ratio factor in the dominant-imaginary denominator · case 01
Complex division forgets the ratio factor in the dominant-imaginary denominator.
ROOT CAUSE
Complex division forgets the ratio factor in the dominant-imaginary denominator. The faulty expression is den=d+c.
VERIFIED REPAIR
Apply the contract at this fault site using den=d+c*r.
Unsuccessful approach: The attempted local correction den=d still violates the explicit regression fixtures.
Case contract
Divide finite complex a+ib by nonzero c+id using a denominator-ratio branch. Fixtures bound products and exercise huge or tiny denominators whose naive squares overflow or underflow. Return rendered real and imaginary components. 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(a,b,c,d):
try:
if c==0 and d==0: return 'zero-denominator'
if abs(c)>=abs(d):
r=d/c
den=c+d*r
real=(a+b*r)/den
imag=(b-a*r)/den
else:
r=c/d
den=d+c
real=(a*r+b)/den
imag=(b*r-a)/den
return [render(real),render(imag)]
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('asymmetric numerator', solve(3.0,2.0,4.0,1.0), [render(14/17),render(5/17)])
check('asymmetric imaginary', solve(3.0,2.0,1.0,4.0), [render(11/17),render(-10/17)])
check('negative imaginary ratio', solve(3.0,2.0,-1.0,4.0), [render(5/17),render(-14/17)])
check('negative extreme ratio', solve(float(N),2.0,-1e200,1e-200), [render(-N/1e200),render(-2e-200)])
check('large real denominator', solve(float(N),2.0,1e200,1e199), [render((N+0.2)/1.01e200),render((2-N*0.1)/1.01e200)])
check('tiny imaginary denominator', solve(float(N),2.0,1e-201,1e-200), [render((N*0.1+2)/1.01e-200),render((0.2-N)/1.01e-200)])
check('normal real branch', solve(float(N),2.0,4.0,1.0), [render((4*N+2)/17),render((8-N)/17)])
check('normal imaginary branch', solve(float(N),2.0,1.0,4.0), [render((N+8)/17),render((2-4*N)/17)])
check('negative denominator', solve(float(N),2.0,-4.0,1.0), [render((-4*N+2)/17),render((-8-N)/17)])
check('pure real', solve(float(N),2.0,2.0,0.0), [render(N/2),"1"])
check('pure imaginary', solve(float(N),2.0,0.0,2.0), ["1",render(-N/2)])
check('zero denominator', solve(float(N),2.0,0.0,0.0), "zero-denominator")
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 |
|---|---|---|---|
| asymmetric numerator | ['0.82352941176', '0.29411764706'] | ['0.82352941176', '0.29411764706'] | Passed |
| asymmetric imaginary | ['0.55', '-0.5'] | ['0.64705882353', '-0.58823529412'] | Failed |
| negative imaginary ratio | ['0.41666666667', '-1.1666666667'] | ['0.29411764706', '-0.82352941176'] | Failed |
| negative extreme ratio | ['-1e-200', '-2e-200'] | ['-1e-200', '-2e-200'] | Passed |
| large real denominator | ['1.1881188119e-200', '1.8811881188e-200'] | ['1.1881188119e-200', '1.8811881188e-200'] | Passed |
| tiny imaginary denominator | ['1.9090909091e+200', '-7.2727272727e+199'] | ['2.0792079208e+200', '-7.9207920792e+199'] | Failed |
| normal real branch | ['0.35294117647', '0.41176470588'] | ['0.35294117647', '0.41176470588'] | Passed |
| normal imaginary branch | ['0.45', '-0.1'] | ['0.52941176471', '-0.11764705882'] | Failed |
| negative denominator | ['-0.11764705882', '-0.52941176471'] | ['-0.11764705882', '-0.52941176471'] | Passed |
| pure real | ['0.5', '1'] | ['0.5', '1'] | Passed |
| pure imaginary | ['1', '-0.5'] | ['1', '-0.5'] | Passed |
| zero denominator | zero-denominator | zero-denominator | Passed |
SHA-256 / d803ac2e9d6dda3432cf171837e9e7e176602a08ddb18738983044b7ad9f746e
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(a,b,c,d):
try:
if c==0 and d==0: return 'zero-denominator'
if abs(c)>=abs(d):
r=d/c
den=c+d*r
real=(a+b*r)/den
imag=(b-a*r)/den
else:
r=c/d
den=d
real=(a*r+b)/den
imag=(b*r-a)/den
return [render(real),render(imag)]
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('asymmetric numerator', solve(3.0,2.0,4.0,1.0), [render(14/17),render(5/17)])
check('asymmetric imaginary', solve(3.0,2.0,1.0,4.0), [render(11/17),render(-10/17)])
check('negative imaginary ratio', solve(3.0,2.0,-1.0,4.0), [render(5/17),render(-14/17)])
check('negative extreme ratio', solve(float(N),2.0,-1e200,1e-200), [render(-N/1e200),render(-2e-200)])
check('large real denominator', solve(float(N),2.0,1e200,1e199), [render((N+0.2)/1.01e200),render((2-N*0.1)/1.01e200)])
check('tiny imaginary denominator', solve(float(N),2.0,1e-201,1e-200), [render((N*0.1+2)/1.01e-200),render((0.2-N)/1.01e-200)])
check('normal real branch', solve(float(N),2.0,4.0,1.0), [render((4*N+2)/17),render((8-N)/17)])
check('normal imaginary branch', solve(float(N),2.0,1.0,4.0), [render((N+8)/17),render((2-4*N)/17)])
check('negative denominator', solve(float(N),2.0,-4.0,1.0), [render((-4*N+2)/17),render((-8-N)/17)])
check('pure real', solve(float(N),2.0,2.0,0.0), [render(N/2),"1"])
check('pure imaginary', solve(float(N),2.0,0.0,2.0), ["1",render(-N/2)])
check('zero denominator', solve(float(N),2.0,0.0,0.0), "zero-denominator")
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 |
|---|---|---|---|
| asymmetric numerator | ['0.82352941176', '0.29411764706'] | ['0.82352941176', '0.29411764706'] | Passed |
| asymmetric imaginary | ['0.6875', '-0.625'] | ['0.64705882353', '-0.58823529412'] | Failed |
| negative imaginary ratio | ['0.3125', '-0.875'] | ['0.29411764706', '-0.82352941176'] | Failed |
| negative extreme ratio | ['-1e-200', '-2e-200'] | ['-1e-200', '-2e-200'] | Passed |
| large real denominator | ['1.1881188119e-200', '1.8811881188e-200'] | ['1.1881188119e-200', '1.8811881188e-200'] | Passed |
| tiny imaginary denominator | ['2.1e+200', '-8e+199'] | ['2.0792079208e+200', '-7.9207920792e+199'] | Failed |
| normal real branch | ['0.35294117647', '0.41176470588'] | ['0.35294117647', '0.41176470588'] | Passed |
| normal imaginary branch | ['0.5625', '-0.125'] | ['0.52941176471', '-0.11764705882'] | Failed |
| negative denominator | ['-0.11764705882', '-0.52941176471'] | ['-0.11764705882', '-0.52941176471'] | Passed |
| pure real | ['0.5', '1'] | ['0.5', '1'] | Passed |
| pure imaginary | ['1', '-0.5'] | ['1', '-0.5'] | Passed |
| zero denominator | zero-denominator | zero-denominator | Passed |
SHA-256 / e34dd5feee649698da0e68e7297a7d9e6a005505dee4d3213b6d0a21ebeabf57
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(a,b,c,d):
try:
if c==0 and d==0: return 'zero-denominator'
if abs(c)>=abs(d):
r=d/c
den=c+d*r
real=(a+b*r)/den
imag=(b-a*r)/den
else:
r=c/d
den=d+c*r
real=(a*r+b)/den
imag=(b*r-a)/den
return [render(real),render(imag)]
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('asymmetric numerator', solve(3.0,2.0,4.0,1.0), [render(14/17),render(5/17)])
check('asymmetric imaginary', solve(3.0,2.0,1.0,4.0), [render(11/17),render(-10/17)])
check('negative imaginary ratio', solve(3.0,2.0,-1.0,4.0), [render(5/17),render(-14/17)])
check('negative extreme ratio', solve(float(N),2.0,-1e200,1e-200), [render(-N/1e200),render(-2e-200)])
check('large real denominator', solve(float(N),2.0,1e200,1e199), [render((N+0.2)/1.01e200),render((2-N*0.1)/1.01e200)])
check('tiny imaginary denominator', solve(float(N),2.0,1e-201,1e-200), [render((N*0.1+2)/1.01e-200),render((0.2-N)/1.01e-200)])
check('normal real branch', solve(float(N),2.0,4.0,1.0), [render((4*N+2)/17),render((8-N)/17)])
check('normal imaginary branch', solve(float(N),2.0,1.0,4.0), [render((N+8)/17),render((2-4*N)/17)])
check('negative denominator', solve(float(N),2.0,-4.0,1.0), [render((-4*N+2)/17),render((-8-N)/17)])
check('pure real', solve(float(N),2.0,2.0,0.0), [render(N/2),"1"])
check('pure imaginary', solve(float(N),2.0,0.0,2.0), ["1",render(-N/2)])
check('zero denominator', solve(float(N),2.0,0.0,0.0), "zero-denominator")
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 |
|---|---|---|---|
| asymmetric numerator | ['0.82352941176', '0.29411764706'] | ['0.82352941176', '0.29411764706'] | Passed |
| asymmetric imaginary | ['0.64705882353', '-0.58823529412'] | ['0.64705882353', '-0.58823529412'] | Passed |
| negative imaginary ratio | ['0.29411764706', '-0.82352941176'] | ['0.29411764706', '-0.82352941176'] | Passed |
| negative extreme ratio | ['-1e-200', '-2e-200'] | ['-1e-200', '-2e-200'] | Passed |
| large real denominator | ['1.1881188119e-200', '1.8811881188e-200'] | ['1.1881188119e-200', '1.8811881188e-200'] | Passed |
| tiny imaginary denominator | ['2.0792079208e+200', '-7.9207920792e+199'] | ['2.0792079208e+200', '-7.9207920792e+199'] | Passed |
| normal real branch | ['0.35294117647', '0.41176470588'] | ['0.35294117647', '0.41176470588'] | Passed |
| normal imaginary branch | ['0.52941176471', '-0.11764705882'] | ['0.52941176471', '-0.11764705882'] | Passed |
| negative denominator | ['-0.11764705882', '-0.52941176471'] | ['-0.11764705882', '-0.52941176471'] | Passed |
| pure real | ['0.5', '1'] | ['0.5', '1'] | Passed |
| pure imaginary | ['1', '-0.5'] | ['1', '-0.5'] | Passed |
| zero denominator | zero-denominator | zero-denominator | Passed |
SHA-256 / ea0c34e8a04d95e0092f14e87c50abcf9d046b26c24874700765c5f3dd5016d2
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:36.015734+00:00.
Case digest / 1292da6d01ae550fb691d0cb10ffbd410020f0faa8979ab3d932237ffd8e9365