FA-16331 / Floating-point arithmetic / Open access
Sinc replaces its removable singularity with zero · case 01
Sinc replaces its removable singularity with zero.
ROOT CAUSE
Sinc replaces its removable singularity with zero. The faulty expression is if x==0: return '0'.
VERIFIED REPAIR
Apply the contract at this fault site using if x==0: return '1'.
Unsuccessful approach: The attempted local correction if x==0: return 'arithmetic-error' 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 '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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero | 0 | 1 | Failed |
| negative zero | 0 | 1 | Failed |
| small | 0.99999999833 | 0.99999999833 | Passed |
| negative small | 0.99999999833 | 0.99999999833 | Passed |
| normal | 0.84147098481 | 0.84147098481 | Passed |
| negative normal | 0.84147098481 | 0.84147098481 | Passed |
| phase crossing | -0.038166599453 | -0.038166599453 | Passed |
SHA-256 / e1c536c3bbf775bc52d895727783049ee47d7929b2311cd8c8b1734d3106b189
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 '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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero | arithmetic-error | 1 | Failed |
| negative zero | arithmetic-error | 1 | Failed |
| small | 0.99999999833 | 0.99999999833 | Passed |
| negative small | 0.99999999833 | 0.99999999833 | Passed |
| normal | 0.84147098481 | 0.84147098481 | Passed |
| negative normal | 0.84147098481 | 0.84147098481 | Passed |
| phase crossing | -0.038166599453 | -0.038166599453 | Passed |
SHA-256 / 7e8ef401ae345d2cff0c6dde11f3e728f42e5bfcbd4c1c86baf4311eb4c18486
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero | 1 | 1 | Passed |
| negative zero | 1 | 1 | Passed |
| small | 0.99999999833 | 0.99999999833 | Passed |
| negative small | 0.99999999833 | 0.99999999833 | Passed |
| normal | 0.84147098481 | 0.84147098481 | Passed |
| negative normal | 0.84147098481 | 0.84147098481 | Passed |
| phase crossing | -0.038166599453 | -0.038166599453 | Passed |
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.357328+00:00.
Case digest / 9319975888eae5e0399f7a4f1934c321ffc710a9557d7ba7bbb0ca705738ae1b