FAILURE MAP
← Case archive

FA-15041 / Numerics / Open access

Negative radix encoding: negative base zero representation · case 01

The exact negative radix encoding result violates the stated contract at negative base zero representation.

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

ROOT CAUSE

The negative base zero representation step uses [] instead of [0].

THE FAILURE

The negative base zero representation step uses [] instead of [0].

Unsuccessful approach: The partial repair [b] still violates the negative base zero representation invariant.

Case contract

Input [integer, magnitude base>=2]; return most-significant-first digits 0..base-1 representing integer in radix -base. Bounds: |integer|<=100 and base<=8.

Why this case matters

Exact discrete arithmetic with observable algorithmic state; no floating point approximation is used.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    n,b=x
    if n==0:return []
    out=[]
    for _ in range(60):
     if n==0:break
     r=n%b
     out.append(r)
     n=(n-r)//(-b)
    return out[::-1] if bool(out) else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-100, 3], [1, 2, 1, 1, 1, 2]), ([-100, 4], [2, 2, 1, 0]), ([-100, 5], [1, 1, 0, 0]), ([-100, 6], [1, 4, 5, 2]), ([-100, 7], [1, 5, 1, 5])], [([0, 3], [0]), ([0, 5], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-98, 5], [1, 1, 0, 2]), ([-98, 6], [1, 4, 5, 4]), ([-98, 7], [1, 5, 0, 0]), ([-98, 8], [1, 7, 5, 6])], [([0, 4], [0]), ([0, 8], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-96, 8], [1, 7, 4, 0]), ([-95, 2], [1, 1, 1, 0, 0, 0, 0, 1]), ([-95, 3], [1, 2, 1, 2, 2, 1]), ([-95, 4], [2, 2, 0, 1])], [([0, 5], [0]), ([0, 4], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-93, 4], [2, 2, 0, 3]), ([-93, 5], [1, 2, 4, 2]), ([-93, 6], [1, 4, 4, 3]), ([-93, 7], [1, 5, 0, 5])], [([0, 6], [0]), ([0, 7], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-91, 7], [1, 6, 6, 0]), ([-91, 8], [1, 7, 4, 5]), ([-90, 2], [1, 1, 1, 1, 1, 0, 1, 0]), ([-90, 3], [1, 2, 1, 2, 0, 0])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
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
explicit oracle 0[][0]Failed
explicit oracle 1[1, 1, 1, 0, 1, 1, 0, 0][1, 1, 1, 0, 1, 1, 0, 0]Passed
explicit oracle 2[2, 4, 4][2, 4, 4]Passed
explicit oracle 3[1, 2, 1, 1, 1, 2][1, 2, 1, 1, 1, 2]Passed
explicit oracle 4[2, 2, 1, 0][2, 2, 1, 0]Passed
explicit oracle 5[1, 1, 0, 0][1, 1, 0, 0]Passed
explicit oracle 6[1, 4, 5, 2][1, 4, 5, 2]Passed
explicit oracle 7[1, 5, 1, 5][1, 5, 1, 5]Passed

SHA-256 / c27e4fe758d26998687649bcc653f789d709dc3385629d862ffed7ca1946e54f

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import itertools
from fractions import Fraction
N = 1
observations = []
def solve(x):
    n,b=x
    if n==0:return [b]
    out=[]
    for _ in range(60):
     if n==0:break
     r=n%b
     out.append(r)
     n=(n-r)//(-b)
    return out[::-1] if bool(out) else []
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-100, 3], [1, 2, 1, 1, 1, 2]), ([-100, 4], [2, 2, 1, 0]), ([-100, 5], [1, 1, 0, 0]), ([-100, 6], [1, 4, 5, 2]), ([-100, 7], [1, 5, 1, 5])], [([0, 3], [0]), ([0, 5], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-98, 5], [1, 1, 0, 2]), ([-98, 6], [1, 4, 5, 4]), ([-98, 7], [1, 5, 0, 0]), ([-98, 8], [1, 7, 5, 6])], [([0, 4], [0]), ([0, 8], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-96, 8], [1, 7, 4, 0]), ([-95, 2], [1, 1, 1, 0, 0, 0, 0, 1]), ([-95, 3], [1, 2, 1, 2, 2, 1]), ([-95, 4], [2, 2, 0, 1])], [([0, 5], [0]), ([0, 4], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-93, 4], [2, 2, 0, 3]), ([-93, 5], [1, 2, 4, 2]), ([-93, 6], [1, 4, 4, 3]), ([-93, 7], [1, 5, 0, 5])], [([0, 6], [0]), ([0, 7], [0]), ([-100, 2], [1, 1, 1, 0, 1, 1, 0, 0]), ([100, 8], [2, 4, 4]), ([-91, 7], [1, 6, 6, 0]), ([-91, 8], [1, 7, 4, 5]), ([-90, 2], [1, 1, 1, 1, 1, 0, 1, 0]), ([-90, 3], [1, 2, 1, 2, 0, 0])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("explicit oracle %d" % i, solve(args), expected)
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
explicit oracle 0[2][0]Failed
explicit oracle 1[1, 1, 1, 0, 1, 1, 0, 0][1, 1, 1, 0, 1, 1, 0, 0]Passed
explicit oracle 2[2, 4, 4][2, 4, 4]Passed
explicit oracle 3[1, 2, 1, 1, 1, 2][1, 2, 1, 1, 1, 2]Passed
explicit oracle 4[2, 2, 1, 0][2, 2, 1, 0]Passed
explicit oracle 5[1, 1, 0, 0][1, 1, 0, 0]Passed
explicit oracle 6[1, 4, 5, 2][1, 4, 5, 2]Passed
explicit oracle 7[1, 5, 1, 5][1, 5, 1, 5]Passed

SHA-256 / d3e0dd100efac3fccd419fa0c84d6de3ebe8f2fce25e85977a9dbdbd4c2ddc7c

HELD IN THE MEMBER ARCHIVE

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

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

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

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

Sign in to the archive ↗

Verification & scope

A deterministic bounded teaching model. Inputs are restricted to the explicit contract; this is not a production algebra library. 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:22.696993+00:00.

Case digest / f9308330a14ea98687abe51cb75c20ac36648f4f044aadecb1bb5ef09a772118