FAILURE MAP
← Case archive

FA-5436 / Integer arithmetic / Open access

Integer signum · case 01

Zero is assigned a positive direction.

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

ROOT CAUSE

Zero is assigned a positive direction.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (n>0)-(n<0)

Unsuccessful approach: Floating sign transfer also treats zero as positive.

Case contract

Integer arguments; denominators, steps, moduli, and bit widths are positive. Unsigned word inputs fit the specified width except where masking is explicitly the operation. Sequence sizes are nonnegative. Integer signum. Exact operational definition: (n>0)-(n<0)

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Integer mathematics results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n):
    return 1 if n>=0 else -1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (-5,)', solve(*(-5,)), -1)
check('fixture 2: (0,)', solve(*(0,)), 0)
check('fixture 3: (7,)', solve(*(7,)), 1)
check('fixture 4: (1606938044258990275541962092341162602522202993782792835301376,)', solve(*(1606938044258990275541962092341162602522202993782792835301376,)), 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)
Boundary fixtureActualExpectedOutcome
fixture 1: (-5,)-1-1Passed
fixture 2: (0,)10Failed
fixture 3: (7,)11Passed
fixture 4: (1606938044258990275541962092341162602522202993782792835301376,)11Passed

SHA-256 / 2dc8ce3bfe48bb387218b01045092d875ee273e52820043694a40c4db0184064

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n):
    return int(math.copysign(1,n))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (-5,)', solve(*(-5,)), -1)
check('fixture 2: (0,)', solve(*(0,)), 0)
check('fixture 3: (7,)', solve(*(7,)), 1)
check('fixture 4: (1606938044258990275541962092341162602522202993782792835301376,)', solve(*(1606938044258990275541962092341162602522202993782792835301376,)), 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)
Boundary fixtureActualExpectedOutcome
fixture 1: (-5,)-1-1Passed
fixture 2: (0,)10Failed
fixture 3: (7,)11Passed
fixture 4: (1606938044258990275541962092341162602522202993782792835301376,)11Passed

SHA-256 / 65f4c2142169daca6042026386e17d62132153102ff861c6e7b2d7928db3f173

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(n):
    return (n>0)-(n<0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (-5,)', solve(*(-5,)), -1)
check('fixture 2: (0,)', solve(*(0,)), 0)
check('fixture 3: (7,)', solve(*(7,)), 1)
check('fixture 4: (1606938044258990275541962092341162602522202993782792835301376,)', solve(*(1606938044258990275541962092341162602522202993782792835301376,)), 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)
Boundary fixtureActualExpectedOutcome
fixture 1: (-5,)-1-1Passed
fixture 2: (0,)00Passed
fixture 3: (7,)11Passed
fixture 4: (1606938044258990275541962092341162602522202993782792835301376,)11Passed

SHA-256 / 9926356ad12a20518881da051e3ea99ba2fe90682643595de32aed3ba4a953ce

Verification & scope

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:37:49.473567+00:00.

Case digest / 7baef65b4070d9a131954c7f21e706df4a2af62c45349e024bf9a5ee8acc7d4b