broken_source:
"""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 '0'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=math.expm1(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

source:
"""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 'arithmetic-error'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=math.expm1(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

prompt:
Exponential relative increment uses a zero removable limit.

Evaluate expm1(x)/x with continuous value one at zero. Inputs are finite and have magnitude at most five. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '1'
        if abs(x)<1e-8:
            result=(math.exp(x)-1)/x
        else:
            result=math.expm1(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""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 '1'
        if abs(x)<1e-8:
            result=1.0
        else:
            result=math.expm1(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

prompt:
Exponential relative increment subtracts rounded unity.

Evaluate expm1(x)/x with continuous value one at zero. Inputs are finite and have magnitude at most five. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=math.expm1(x)/abs(x)
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

source:
"""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 '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=abs(math.expm1(x))/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

prompt:
Exponential relative increment divides by unsigned magnitude.

Evaluate expm1(x)/x with continuous value one at zero. Inputs are finite and have magnitude at most five. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

source:
"""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 '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=math.log1p(abs(x))/abs(x)
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

prompt:
Exponential relative increment uses its logarithmic inverse.

Evaluate expm1(x)/x with continuous value one at zero. Inputs are finite and have magnitude at most five. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=(math.exp(x)-1)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

source:
"""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 '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=(math.exp(x)-1)/x if abs(x)>1e-8 else 1.0
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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)

prompt:
Exponential relative increment loses accuracy above its series switch.

Evaluate expm1(x)/x with continuous value one at zero. Inputs are finite and have magnitude at most five. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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<=-1: return 'domain'
        if x==0: return '0'
        if abs(x)<1e-8:
            result=1-x/2+x*x/3
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

source:
"""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<=-1: return 'domain'
        if x==0: return 'arithmetic-error'
        if abs(x)<1e-8:
            result=1-x/2+x*x/3
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

prompt:
Relative logarithm assigns zero to a removable singularity.

Evaluate log1p(x)/x on x>-1 with continuous value one at zero. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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<=-1: return 'domain'
        if x==0: return '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/3
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

source:
"""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<=-1: return 'domain'
        if x==0: return '1'
        if abs(x)<1e-8:
            result=1.0
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

prompt:
Relative logarithm uses the exponential series sign.

Evaluate log1p(x)/x on x>-1 with continuous value one at zero. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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<=-1: return 'domain'
        if x==0: return '1'
        if abs(x)<1e-8:
            result=math.log(1+x)/x
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

source:
"""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<=-1: return 'domain'
        if x==0: return '1'
        if abs(x)<1e-8:
            result=math.log(max(1+x,1))/x
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

prompt:
Relative logarithm loses tiny increments before the log.

Evaluate log1p(x)/x on x>-1 with continuous value one at zero. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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<=-1: x=-0.999999999
        if x==0: return '1'
        if abs(x)<1e-8:
            result=1-x/2+x*x/3
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

source:
"""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<=-1: return '+infinity'
        if x==0: return '1'
        if abs(x)<1e-8:
            result=1-x/2+x*x/3
        else:
            result=math.log1p(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

prompt:
Relative logarithm clamps a pole to a finite denominator.

Evaluate log1p(x)/x on x>-1 with continuous value one at zero. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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<=-1: return 'domain'
        if x==0: return '1'
        if abs(x)<1e-8:
            result=1-x/2+x*x/3
        else:
            result=math.log(1+x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

source:
"""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<=-1: return 'domain'
        if x==0: return '1'
        if abs(x)<1e-8:
            result=1-x/2+x*x/3
        else:
            result=math.log(1+abs(x))/abs(x)
        return render(result)
    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('zero', solve(0.0), "1")
check('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(1e-7)/1e-7))
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)

prompt:
Relative logarithm uses an inaccurate non-log1p branch.

Evaluate log1p(x)/x on x>-1 with continuous value one at zero. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '0'
        if abs(x)<1e-3:
            t=x*x
            result=1-t/6+t*t/120
        else:
            result=math.sin(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

source:
"""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 'arithmetic-error'
        if abs(x)<1e-3:
            t=x*x
            result=1-t/6+t*t/120
        else:
            result=math.sin(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

prompt:
Sinc replaces its removable singularity with zero.

Evaluate sin(x)/x on finite x with continuous value one at zero. Tiny values use the fourth-degree even series. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '1'
        if abs(x)<1e-3:
            t=x
            result=1-t/6+t*t/120
        else:
            result=math.sin(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

source:
"""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 '1'
        if abs(x)<1e-3:
            t=abs(x)
            result=1-t/6+t*t/120
        else:
            result=math.sin(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

prompt:
Sinc series uses x instead of x squared.

Evaluate sin(x)/x on finite x with continuous value one at zero. Tiny values use the fourth-degree even series. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '1'
        if abs(x)<1e-3:
            t=x*x
            result=1+t/6+t*t/120
        else:
            result=math.sin(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

source:
"""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 '1'
        if abs(x)<1e-3:
            t=x*x
            result=1-t/2+t*t/24
        else:
            result=math.sin(x)/x
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

prompt:
Sinc series has the hyperbolic sine curvature.

Evaluate sin(x)/x on finite x with continuous value one at zero. Tiny values use the fourth-degree even series. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '1'
        if abs(x)<1e-3:
            t=x*x
            result=1-t/6+t*t/120
        else:
            result=math.sin(x)/abs(x)
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

source:
"""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 '1'
        if abs(x)<1e-3:
            t=x*x
            result=1-t/6+t*t/120
        else:
            result=abs(math.sin(x))/abs(x)
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

prompt:
Sinc divides the sine by unsigned magnitude.

Evaluate sin(x)/x on finite x with continuous value one at zero. Tiny values use the fourth-degree even series. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '1'
        if abs(x)<1e-3:
            t=x*x
            result=1-t/6+t*t/120
        else:
            result=math.sin(x)/math.remainder(x,2*math.pi)
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

source:
"""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 '1'
        if abs(x)<1e-3:
            t=x*x
            result=1-t/6+t*t/120
        else:
            result=math.sin(x)/math.fmod(x,math.pi)
        return render(result)
    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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('small', solve(N*1e-4), render(math.sin(N*1e-4)/(N*1e-4)))
check('negative small', solve(-N*1e-4), render(math.sin(-N*1e-4)/(-N*1e-4)))
check('normal', solve(float(N)), render(math.sin(N)/N))
check('negative normal', solve(-float(N)), render(math.sin(-N)/(-N)))
check('phase crossing', solve(math.pi+0.125*N), render(math.sin(math.pi+0.125*N)/(math.pi+0.125*N)))
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)

prompt:
Sinc folds the denominator along with the periodic numerator.

Evaluate sin(x)/x on finite x with continuous value one at zero. Tiny values use the fourth-degree even series. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '-0'
        s=math.sin(x/2)
        result=math.cos(x)-1
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

source:
"""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 '-0'
        s=math.sin(x/2)
        result=min(0.0,math.cos(x)-1)
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

prompt:
Cosine decrement subtracts one after rounding.

Evaluate cos(x)-1 for finite x without cancellation using the half-angle identity. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '-0'
        s=math.sin(x)
        result=-2*s*s
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

source:
"""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 '-0'
        s=math.sin(x)/2
        result=-2*s*s
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

prompt:
Cosine decrement forgets half-angle reduction.

Evaluate cos(x)-1 for finite x without cancellation using the half-angle identity. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '-0'
        s=math.sin(x/2)
        result=-2*s
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

source:
"""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 '-0'
        s=math.sin(x/2)
        result=-2*abs(s)
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

prompt:
Cosine decrement fails to square the half-angle sine.

Evaluate cos(x)-1 for finite x without cancellation using the half-angle identity. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '-0'
        s=math.sin(x/2)
        result=2*s*s
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

source:
"""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 '-0'
        s=math.sin(x/2)
        result=-s*s
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

prompt:
Cosine decrement returns a positive half-angle square.

Evaluate cos(x)-1 for finite x without cancellation using the half-angle identity. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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 '0'
        s=math.sin(x/2)
        result=-2*s*s
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

source:
"""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)
        s=math.sin(x/2)
        result=-2*s*s
        return render(result)
    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('tiny', solve(N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('negative tiny', solve(-N*2.0**-30), render(-0.5*(N*2.0**-30)**2))
check('normal', solve(float(N)), render(-2*math.sin(N/2)**2))
check('negative normal', solve(-float(N)), render(-2*math.sin(N/2)**2))
check('zero', solve(0.0), "-0")
check('pi', solve(math.pi), "-2")
check('half pi', solve(math.pi/2), "-1")
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)

prompt:
Cosine decrement violates its limiting zero sign.

Evaluate cos(x)-1 for finite x without cancellation using the half-angle identity. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

split: open-access


broken_source:
"""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=c/d
            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)

source:
"""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=abs(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)

prompt:
Complex division inverts its real-dominant denominator ratio.

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.

split: open-access


broken_source:
"""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=d/c
            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)

source:
"""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=abs(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)

prompt:
Complex division inverts its imaginary-dominant denominator ratio.

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.

split: open-access


broken_source:
"""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
            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)

source:
"""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
            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)

prompt:
Complex division forgets the ratio factor in the dominant-real denominator.

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.

split: open-access


broken_source:
"""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)

source:
"""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)

prompt:
Complex division forgets the ratio factor in the dominant-imaginary denominator.

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.

split: open-access


broken_source:
"""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)

source:
"""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*r+b)/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)

prompt:
Dominant-real complex division conjugates the wrong numerator term.

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.

split: open-access


broken_source:
"""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)

source:
"""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=(a-b*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)

prompt:
Dominant-real complex division misses the conjugation sign.

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.

split: open-access


broken_source:
"""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)

source:
"""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)

prompt:
Dominant-imaginary division scales the wrong real numerator term.

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.

split: open-access


broken_source:
"""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=(a-b*r)/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)

source:
"""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)

prompt:
Dominant-imaginary division reverses its imaginary numerator.

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.

split: open-access