FAILURE MAP
← Case archive

FA-16346 / Floating-point arithmetic / Open access

Sinc divides the sine by unsigned magnitude · case 01

Sinc divides the sine by unsigned magnitude.

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

ROOT CAUSE

Sinc divides the sine by unsigned magnitude. The faulty expression is result=math.sin(x)/abs(x).

VERIFIED REPAIR

Apply the contract at this fault site using result=math.sin(x)/x.

Unsuccessful approach: The attempted local correction result=abs(math.sin(x))/abs(x) still violates the explicit regression fixtures.

Case contract

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.

Why this case matters

An offline floating representation model isolates a reproducible arithmetic fault.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
    if math.isnan(x): return 'nan'
    if math.isinf(x): return '-infinity' if x<0 else '+infinity'
    return format(x,'.11g')

N = 1
observations = []
def solve(x):
    try:
        if x==0: return '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)
Boundary fixtureActualExpectedOutcome
zero11Passed
negative zero11Passed
small0.999999998330.99999999833Passed
negative small0.999999998330.99999999833Passed
normal0.841470984810.84147098481Passed
negative normal-0.841470984810.84147098481Failed
phase crossing-0.038166599453-0.038166599453Passed

SHA-256 / 08c0c3adf0c4888ca4e876142ab7475bfc45f5261f3da8d609ad0f63e09e623f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
    if math.isnan(x): return 'nan'
    if math.isinf(x): return '-infinity' if x<0 else '+infinity'
    return format(x,'.11g')

N = 1
observations = []
def solve(x):
    try:
        if x==0: return '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)
Boundary fixtureActualExpectedOutcome
zero11Passed
negative zero11Passed
small0.999999998330.99999999833Passed
negative small0.999999998330.99999999833Passed
normal0.841470984810.84147098481Passed
negative normal0.841470984810.84147098481Passed
phase crossing0.038166599453-0.038166599453Failed

SHA-256 / f69157289bc223e02d351d6d015fe5f1772c1be30d882ad28b444f6393f4ad4e

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
    if math.isnan(x): return 'nan'
    if math.isinf(x): return '-infinity' if x<0 else '+infinity'
    return format(x,'.11g')

N = 1
observations = []
def solve(x):
    try:
        if x==0: return '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)
Boundary fixtureActualExpectedOutcome
zero11Passed
negative zero11Passed
small0.999999998330.99999999833Passed
negative small0.999999998330.99999999833Passed
normal0.841470984810.84147098481Passed
negative normal0.841470984810.84147098481Passed
phase crossing-0.038166599453-0.038166599453Passed

SHA-256 / ae22c0a2889ac818972e70cc72be1b702de4e30ecdff2ffa50f781c55900d8e9

Verification & scope

Controlled binary64 or explicitly stipulated miniature format; no hardware exception flags or platform floating environment are modeled. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:39:35.363586+00:00.

Case digest / 559d8c1392252b19cf2e88fcd110fd66bb0670ab794d8d5554306587bf3236ee