FAILURE MAP
← Case archive

FA-16411 / Floating-point arithmetic / Open access

Dominant-imaginary division scales the wrong real numerator term · case 01

Dominant-imaginary division scales the wrong real numerator term.

Verified by executionVariant 1 · 12 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Dominant-imaginary division scales the wrong real numerator term. The faulty expression is real=(a+b*r)/den.

THE FAILURE

Dominant-imaginary division scales the wrong real numerator term. The faulty expression is real=(a+b*r)/den.

Unsuccessful approach: The attempted local correction real=(a*r-b)/den 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*r
            real=(a+b*r)/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 fixtureActualExpectedOutcome
asymmetric numerator['0.82352941176', '0.29411764706']['0.82352941176', '0.29411764706']Passed
asymmetric imaginary['0.82352941176', '-0.58823529412']['0.64705882353', '-0.58823529412']Failed
negative imaginary ratio['0.58823529412', '-0.82352941176']['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.1881188119e+200', '-7.9207920792e+199']['2.0792079208e+200', '-7.9207920792e+199']Failed
normal real branch['0.35294117647', '0.41176470588']['0.35294117647', '0.41176470588']Passed
normal imaginary branch['0.35294117647', '-0.11764705882']['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['0.5', '-0.5']['1', '-0.5']Failed
zero denominatorzero-denominatorzero-denominatorPassed

SHA-256 / ed2a2b4fe70de81d8d475f5e39e707e3caaab0850acf38900304c8ad3e862c96

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+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 fixtureActualExpectedOutcome
asymmetric numerator['0.82352941176', '0.29411764706']['0.82352941176', '0.29411764706']Passed
asymmetric imaginary['-0.29411764706', '-0.58823529412']['0.64705882353', '-0.58823529412']Failed
negative imaginary ratio['-0.64705882353', '-0.82352941176']['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.8811881188e+200', '-7.9207920792e+199']['2.0792079208e+200', '-7.9207920792e+199']Failed
normal real branch['0.35294117647', '0.41176470588']['0.35294117647', '0.41176470588']Passed
normal imaginary branch['-0.41176470588', '-0.11764705882']['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']Failed
zero denominatorzero-denominatorzero-denominatorPassed

SHA-256 / bc3721750b1be02a257464b6d0c02b3875fc378e8f6451ea1282e5b5535ae0d9

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 12 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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.064534+00:00.

Case digest / f7d499b303c7d75e3e1831a3ba5b089eb7071cb0764d81568ac907ef7698fd9e