FA-16746 / Floating-point arithmetic / Open access
Sine-pi multiplies an unreduced large argument by pi · case 01
Sine-pi multiplies an unreduced large argument by pi.
ROOT CAUSE
Sine-pi multiplies an unreduced large argument by pi. The faulty expression is r=x.
VERIFIED REPAIR
Apply the contract at this fault site using r=math.remainder(x,2.0).
Unsuccessful approach: The attempted local correction r=math.remainder(math.pi*x,2*math.pi)/math.pi still violates the explicit regression fixtures.
Case contract
Evaluate sin(pi*x) for finite x using modulo-two reduction, with exact integer zeros carrying the sign of x and exact half-integer extrema. 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:
r=x
if r==0 or abs(r)==1: return render(math.copysign(0.0,x))
if r==0.5: return '1'
if r==-0.5: return '-1'
if r>0.5: r=1-r
elif r < -0.5: r=-1-r
return render(math.sin(math.pi*r))
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('remainder sign reversal', solve(3.0), "0")
check('positive integer', solve(float(N)), "0")
check('negative integer', solve(-float(N)), "-0")
check('half positive', solve(2.0*N+0.5), "1")
check('half negative', solve(-2.0*N-0.5), "-1")
check('quarter', solve(2.0*N+0.25), render(math.sqrt(0.5)))
check('three quarters', solve(2.0*N+0.75), render(math.sqrt(0.5)))
check('negative three quarters', solve(-2.0*N-0.75), render(-math.sqrt(0.5)))
check('large integer', solve(2.0**52+N), "0")
check('negative zero', solve(-0.0), "-0")
check('near integer', solve(1.0-2.0**-40), render(math.sin(math.pi*2.0**-40)))
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 |
|---|---|---|---|
| remainder sign reversal | 2.4492935983e-16 | 0 | Failed |
| positive integer | 0 | 0 | Passed |
| negative integer | -0 | -0 | Passed |
| half positive | 1 | 1 | Passed |
| half negative | -1 | -1 | Passed |
| quarter | 0.70710678119 | 0.70710678119 | Passed |
| three quarters | 0.70710678119 | 0.70710678119 | Passed |
| negative three quarters | -0.70710678119 | -0.70710678119 | Passed |
| large integer | 0.52399258622 | 0 | Failed |
| negative zero | -0 | -0 | Passed |
| near integer | 2.8572618736e-12 | 2.8572618736e-12 | Passed |
SHA-256 / b9d77175a12930879ed0544d801564a84a58a1bf7f0c54bc31539e1514eef50e
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:
r=math.remainder(math.pi*x,2*math.pi)/math.pi
if r==0 or abs(r)==1: return render(math.copysign(0.0,x))
if r==0.5: return '1'
if r==-0.5: return '-1'
if r>0.5: r=1-r
elif r < -0.5: r=-1-r
return render(math.sin(math.pi*r))
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('remainder sign reversal', solve(3.0), "0")
check('positive integer', solve(float(N)), "0")
check('negative integer', solve(-float(N)), "-0")
check('half positive', solve(2.0*N+0.5), "1")
check('half negative', solve(-2.0*N-0.5), "-1")
check('quarter', solve(2.0*N+0.25), render(math.sqrt(0.5)))
check('three quarters', solve(2.0*N+0.75), render(math.sqrt(0.5)))
check('negative three quarters', solve(-2.0*N-0.75), render(-math.sqrt(0.5)))
check('large integer', solve(2.0**52+N), "0")
check('negative zero', solve(-0.0), "-0")
check('near integer', solve(1.0-2.0**-40), render(math.sin(math.pi*2.0**-40)))
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 |
|---|---|---|---|
| remainder sign reversal | 0 | 0 | Passed |
| positive integer | 0 | 0 | Passed |
| negative integer | -0 | -0 | Passed |
| half positive | 1 | 1 | Passed |
| half negative | -1 | -1 | Passed |
| quarter | 0.70710678119 | 0.70710678119 | Passed |
| three quarters | 0.70710678119 | 0.70710678119 | Passed |
| negative three quarters | -0.70710678119 | -0.70710678119 | Passed |
| large integer | -0.75680249531 | 0 | Failed |
| negative zero | -0 | -0 | Passed |
| near integer | 2.8572618736e-12 | 2.8572618736e-12 | Passed |
SHA-256 / 579e7a7d161ae110f21fbfa24f5593d98b2c3fd72596a27dabbc6b1b59e27cd6
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:
r=math.remainder(x,2.0)
if r==0 or abs(r)==1: return render(math.copysign(0.0,x))
if r==0.5: return '1'
if r==-0.5: return '-1'
if r>0.5: r=1-r
elif r < -0.5: r=-1-r
return render(math.sin(math.pi*r))
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('remainder sign reversal', solve(3.0), "0")
check('positive integer', solve(float(N)), "0")
check('negative integer', solve(-float(N)), "-0")
check('half positive', solve(2.0*N+0.5), "1")
check('half negative', solve(-2.0*N-0.5), "-1")
check('quarter', solve(2.0*N+0.25), render(math.sqrt(0.5)))
check('three quarters', solve(2.0*N+0.75), render(math.sqrt(0.5)))
check('negative three quarters', solve(-2.0*N-0.75), render(-math.sqrt(0.5)))
check('large integer', solve(2.0**52+N), "0")
check('negative zero', solve(-0.0), "-0")
check('near integer', solve(1.0-2.0**-40), render(math.sin(math.pi*2.0**-40)))
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 |
|---|---|---|---|
| remainder sign reversal | 0 | 0 | Passed |
| positive integer | 0 | 0 | Passed |
| negative integer | -0 | -0 | Passed |
| half positive | 1 | 1 | Passed |
| half negative | -1 | -1 | Passed |
| quarter | 0.70710678119 | 0.70710678119 | Passed |
| three quarters | 0.70710678119 | 0.70710678119 | Passed |
| negative three quarters | -0.70710678119 | -0.70710678119 | Passed |
| large integer | 0 | 0 | Passed |
| negative zero | -0 | -0 | Passed |
| near integer | 2.8572618736e-12 | 2.8572618736e-12 | Passed |
SHA-256 / 3883052a73cc4a94e83ee2a606013d3902d006c18fde9276e67cf26477619097
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:39.490649+00:00.
Case digest / f45e0b905ed7baac7bf3457c54de5194c12527d45d4e1a5be677f673f49d5ce3