FAILURE MAP
← Case archive

FA-5841 / Planar geometry / Open access

Degree shortest signed turn · case 01

Raw subtraction takes long turns across the wrap point.

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

ROOT CAUSE

Raw subtraction takes long turns across the wrap point.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return (end-start+180)%360-180

Unsuccessful approach: Unsigned reduction loses turn direction.

Case contract

Integer coordinates and lengths, with exact arithmetic except for indicated division results. Lengths are nonnegative. Rectangles are (xmin,ymin,xmax,ymax) with ordered bounds; coordinate vectors have matching dimensions. Degree shortest signed turn. Exact operational definition: (end-start+180)%360-180

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Planar geometry 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(start, end):
    return end-start
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (350, 10)', solve(*(350, 10)), 20)
check('fixture 2: (10, 350)', solve(*(10, 350)), -20)
check('fixture 3: (0, 180)', solve(*(0, 180)), -180)
check('fixture 4: (30, 30)', solve(*(30, 30)), 0)
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: (350, 10)-34020Failed
fixture 2: (10, 350)340-20Failed
fixture 3: (0, 180)180-180Failed
fixture 4: (30, 30)00Passed

SHA-256 / 66b9ff1ccf058d7137c44c9fe9e428cb43252050183eba801ff70f33e3762523

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(start, end):
    return (end-start)%360
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (350, 10)', solve(*(350, 10)), 20)
check('fixture 2: (10, 350)', solve(*(10, 350)), -20)
check('fixture 3: (0, 180)', solve(*(0, 180)), -180)
check('fixture 4: (30, 30)', solve(*(30, 30)), 0)
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: (350, 10)2020Passed
fixture 2: (10, 350)340-20Failed
fixture 3: (0, 180)180-180Failed
fixture 4: (30, 30)00Passed

SHA-256 / adf4e35090e1809e5f597e62a6cc6fc9e08d0e9e71fcc4c9c91ed4f625000765

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(start, end):
    return (end-start+180)%360-180
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (350, 10)', solve(*(350, 10)), 20)
check('fixture 2: (10, 350)', solve(*(10, 350)), -20)
check('fixture 3: (0, 180)', solve(*(0, 180)), -180)
check('fixture 4: (30, 30)', solve(*(30, 30)), 0)
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: (350, 10)2020Passed
fixture 2: (10, 350)-20-20Passed
fixture 3: (0, 180)-180-180Passed
fixture 4: (30, 30)00Passed

SHA-256 / ffa1fce6b1b0a1c7ae38a30447d95351f6ab091df99563a06f4b796740ceb1d9

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

Case digest / 088b95925d05147d4e7832532ee9ff47eb6ffe2bc3a9db144b96f11bd44059d9