FAILURE MAP
← Case archive

FA-91486 / Digital signal filters / Open access

Q15 smoother passes out-of-range inputs through · case 01

An input of 40000 drives the state above 32767.

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

ROOT CAUSE

Inputs are not clamped to the int16 range before filtering.

VERIFIED REPAIR

Clamp inputs to [-32768, 32767].

Unsuccessful approach: The attempted repair clamps symmetrically to +-32767, mis-saturating the most negative input.

Case contract

Input [alpha, samples]; alpha is Q15 in [0, 32768] ("bad-alpha" otherwise). Inputs are saturated to int16; y += ((x - y) * alpha + 2**14) >> 15 (round half up on the Q15 product via arithmetic shift), starting at y = 0. Return the integer outputs.

Why this case matters

Fixed-point exponential smoothers run on microcontrollers; rounding direction and saturation slips cause bias and limit cycles.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    alpha, xs = x
    if not 0 <= alpha <= 32768:
        return 'bad-alpha'
    y = 0
    out = []
    for v in xs:
        y = y + (((v - y) * alpha + (1 << 14)) >> 15)
        out.append(y)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: input beyond range', [16384, [40000, 40000, -40000]], [16384, 24576, -4096]], ['regression: random smoother 0', [24576, [-8, -38976, 37]], [-6, -24577, -6116]], ['regression: random smoother 9', [32768, [-37759, -22144, -45]], [-32768, -22144, -45]], ['control: negative step', [16384, [-1, -1, -1]], [0, 0, 0]], ['control: alpha one', [32768, [100, -5, 7]], [100, -5, 7]], ['control: alpha zero', [0, [5, 5]], [0, 0]], ['control: bad alpha', [40000, [1]], 'bad-alpha']], [['regression: random smoother 9', [32768, [-37759, -22144, -45]], [-32768, -22144, -45]], ['regression: random smoother 11', [24576, [12306, -35386, 1164, 8403, 12704, 26]], [9230, -22268, -4694, 5129, 10810, 2722]], ['regression: random smoother 19', [24576, [-1436, -36936, -26, 4657, 23423, 50]], [-1077, -24845, -6231, 1935, 18051, 4550]], ['control: small negative tie', [16384, [-3, 0, 0]], [-1, 0, 0]], ['control: random smoother 1', [8192, [38, 13765]], [10, 3449]], ['control: random smoother 2', [32768, [-33, 20874, -43, 6, -28]], [-33, 20874, -43, 6, -28]], ['control: random smoother 3', [32768, [8, 9547, 10, -20745, -49, 4]], [8, 9547, 10, -20745, -49, 4]]], [['regression: random smoother 19', [24576, [-1436, -36936, -26, 4657, 23423, 50]], [-1077, -24845, -6231, 1935, 18051, 4550]], ['regression: random smoother 23', [1000, [-41, -9358, 34459, -23, -37857, 34]], [-1, -287, 722, 699, -322, -311]], ['regression: random smoother 26', [32768, [-4554, -6260, -33961]], [-4554, -6260, -32768]], ['control: random smoother 4', [8192, [20, -2539]], [5, -631]], ['control: random smoother 6', [8192, [16294, 2, -779, 14009]], [4074, 3056, 2097, 5075]], ['control: random smoother 7', [1000, [-8425, 39]], [-257, -248]], ['control: random smoother 8', [30000, [45, -46]], [41, -39]]], [['regression: random smoother 26', [32768, [-4554, -6260, -33961]], [-4554, -6260, -32768]], ['regression: random smoother 27', [30000, [29, 35476, 0]], [27, 30001, 2534]], ['regression: random smoother 32', [30000, [-38866, -29411, -4388, 9, 39, -36]], [-30000, -29461, -6506, -541, -10, -34]], ['control: random smoother 10', [32768, [-12, -3127, -26, -45, -25]], [-12, -3127, -26, -45, -25]], ['control: random smoother 13', [8192, [-8, -27561]], [-2, -6892]], ['control: random smoother 14', [24576, [-12991, -22604, 32, -18621, -30, -36, -10331]], [-9743, -19389, -4823, -15171, -3815, -981, -7993]], ['control: random smoother 15', [30000, [13636, -12457, -1, -11, 49, 0]], [12484, -10350, -875, -84, 38, 3]]], [['regression: random smoother 31', [1000, [-31930, 15, 3, -6, -36514]], [-974, -944, -915, -887, -1860]], ['regression: random smoother 32', [30000, [-38866, -29411, -4388, 9, 39, -36]], [-30000, -29461, -6506, -541, -10, -34]], ['regression: input beyond range', [16384, [40000, 40000, -40000]], [16384, 24576, -4096]], ['control: random smoother 16', [8192, [-12962, 19012, 49, -24286]], [-3240, 2323, 1755, -4755]], ['control: random smoother 17', [16384, [-8485, -763, -9, 25855, -11982, -28816, 38]], [-4242, -2502, -1255, 12300, 159, -14328, -7145]], ['control: random smoother 18', [24576, [-8497, -36]], [-6373, -1620]], ['control: random smoother 20', [16384, [6, -12155, -29083, 31]], [3, -6076, -17579, -8774]]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: input beyond range[20000, 30000, -5000][16384, 24576, -4096]Failed
regression: random smoother 0[-6, -29233, -7280][-6, -24577, -6116]Failed
regression: random smoother 9[-37759, -22144, -45][-32768, -22144, -45]Failed
control: negative step[0, 0, 0][0, 0, 0]Passed
control: alpha one[100, -5, 7][100, -5, 7]Passed
control: alpha zero[0, 0][0, 0]Passed
control: bad alphabad-alphabad-alphaPassed

SHA-256 / d466ca892d96e5dd9377ee88d4d1e378ddcc6a583b8f7176e100bf4740e35121

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    alpha, xs = x
    if not 0 <= alpha <= 32768:
        return 'bad-alpha'
    y = 0
    out = []
    for v in xs:
        v = max(-32767, min(32767, v))
        y = y + (((v - y) * alpha + (1 << 14)) >> 15)
        out.append(y)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: input beyond range', [16384, [40000, 40000, -40000]], [16384, 24576, -4096]], ['regression: random smoother 0', [24576, [-8, -38976, 37]], [-6, -24577, -6116]], ['regression: random smoother 9', [32768, [-37759, -22144, -45]], [-32768, -22144, -45]], ['control: negative step', [16384, [-1, -1, -1]], [0, 0, 0]], ['control: alpha one', [32768, [100, -5, 7]], [100, -5, 7]], ['control: alpha zero', [0, [5, 5]], [0, 0]], ['control: bad alpha', [40000, [1]], 'bad-alpha']], [['regression: random smoother 9', [32768, [-37759, -22144, -45]], [-32768, -22144, -45]], ['regression: random smoother 11', [24576, [12306, -35386, 1164, 8403, 12704, 26]], [9230, -22268, -4694, 5129, 10810, 2722]], ['regression: random smoother 19', [24576, [-1436, -36936, -26, 4657, 23423, 50]], [-1077, -24845, -6231, 1935, 18051, 4550]], ['control: small negative tie', [16384, [-3, 0, 0]], [-1, 0, 0]], ['control: random smoother 1', [8192, [38, 13765]], [10, 3449]], ['control: random smoother 2', [32768, [-33, 20874, -43, 6, -28]], [-33, 20874, -43, 6, -28]], ['control: random smoother 3', [32768, [8, 9547, 10, -20745, -49, 4]], [8, 9547, 10, -20745, -49, 4]]], [['regression: random smoother 19', [24576, [-1436, -36936, -26, 4657, 23423, 50]], [-1077, -24845, -6231, 1935, 18051, 4550]], ['regression: random smoother 23', [1000, [-41, -9358, 34459, -23, -37857, 34]], [-1, -287, 722, 699, -322, -311]], ['regression: random smoother 26', [32768, [-4554, -6260, -33961]], [-4554, -6260, -32768]], ['control: random smoother 4', [8192, [20, -2539]], [5, -631]], ['control: random smoother 6', [8192, [16294, 2, -779, 14009]], [4074, 3056, 2097, 5075]], ['control: random smoother 7', [1000, [-8425, 39]], [-257, -248]], ['control: random smoother 8', [30000, [45, -46]], [41, -39]]], [['regression: random smoother 26', [32768, [-4554, -6260, -33961]], [-4554, -6260, -32768]], ['regression: random smoother 27', [30000, [29, 35476, 0]], [27, 30001, 2534]], ['regression: random smoother 32', [30000, [-38866, -29411, -4388, 9, 39, -36]], [-30000, -29461, -6506, -541, -10, -34]], ['control: random smoother 10', [32768, [-12, -3127, -26, -45, -25]], [-12, -3127, -26, -45, -25]], ['control: random smoother 13', [8192, [-8, -27561]], [-2, -6892]], ['control: random smoother 14', [24576, [-12991, -22604, 32, -18621, -30, -36, -10331]], [-9743, -19389, -4823, -15171, -3815, -981, -7993]], ['control: random smoother 15', [30000, [13636, -12457, -1, -11, 49, 0]], [12484, -10350, -875, -84, 38, 3]]], [['regression: random smoother 31', [1000, [-31930, 15, 3, -6, -36514]], [-974, -944, -915, -887, -1860]], ['regression: random smoother 32', [30000, [-38866, -29411, -4388, 9, 39, -36]], [-30000, -29461, -6506, -541, -10, -34]], ['regression: input beyond range', [16384, [40000, 40000, -40000]], [16384, 24576, -4096]], ['control: random smoother 16', [8192, [-12962, 19012, 49, -24286]], [-3240, 2323, 1755, -4755]], ['control: random smoother 17', [16384, [-8485, -763, -9, 25855, -11982, -28816, 38]], [-4242, -2502, -1255, 12300, 159, -14328, -7145]], ['control: random smoother 18', [24576, [-8497, -36]], [-6373, -1620]], ['control: random smoother 20', [16384, [6, -12155, -29083, 31]], [3, -6076, -17579, -8774]]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: input beyond range[16384, 24576, -4095][16384, 24576, -4096]Failed
regression: random smoother 0[-6, -24577, -6116][-6, -24577, -6116]Passed
regression: random smoother 9[-32767, -22144, -45][-32768, -22144, -45]Failed
control: negative step[0, 0, 0][0, 0, 0]Passed
control: alpha one[100, -5, 7][100, -5, 7]Passed
control: alpha zero[0, 0][0, 0]Passed
control: bad alphabad-alphabad-alphaPassed

SHA-256 / 83adbfb1eba982d36c8ff1332e4050f9c0bf16337fe954d890baddbe3c77e6d2

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    alpha, xs = x
    if not 0 <= alpha <= 32768:
        return 'bad-alpha'
    y = 0
    out = []
    for v in xs:
        v = max(-32768, min(32767, v))
        y = y + (((v - y) * alpha + (1 << 14)) >> 15)
        out.append(y)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: input beyond range', [16384, [40000, 40000, -40000]], [16384, 24576, -4096]], ['regression: random smoother 0', [24576, [-8, -38976, 37]], [-6, -24577, -6116]], ['regression: random smoother 9', [32768, [-37759, -22144, -45]], [-32768, -22144, -45]], ['control: negative step', [16384, [-1, -1, -1]], [0, 0, 0]], ['control: alpha one', [32768, [100, -5, 7]], [100, -5, 7]], ['control: alpha zero', [0, [5, 5]], [0, 0]], ['control: bad alpha', [40000, [1]], 'bad-alpha']], [['regression: random smoother 9', [32768, [-37759, -22144, -45]], [-32768, -22144, -45]], ['regression: random smoother 11', [24576, [12306, -35386, 1164, 8403, 12704, 26]], [9230, -22268, -4694, 5129, 10810, 2722]], ['regression: random smoother 19', [24576, [-1436, -36936, -26, 4657, 23423, 50]], [-1077, -24845, -6231, 1935, 18051, 4550]], ['control: small negative tie', [16384, [-3, 0, 0]], [-1, 0, 0]], ['control: random smoother 1', [8192, [38, 13765]], [10, 3449]], ['control: random smoother 2', [32768, [-33, 20874, -43, 6, -28]], [-33, 20874, -43, 6, -28]], ['control: random smoother 3', [32768, [8, 9547, 10, -20745, -49, 4]], [8, 9547, 10, -20745, -49, 4]]], [['regression: random smoother 19', [24576, [-1436, -36936, -26, 4657, 23423, 50]], [-1077, -24845, -6231, 1935, 18051, 4550]], ['regression: random smoother 23', [1000, [-41, -9358, 34459, -23, -37857, 34]], [-1, -287, 722, 699, -322, -311]], ['regression: random smoother 26', [32768, [-4554, -6260, -33961]], [-4554, -6260, -32768]], ['control: random smoother 4', [8192, [20, -2539]], [5, -631]], ['control: random smoother 6', [8192, [16294, 2, -779, 14009]], [4074, 3056, 2097, 5075]], ['control: random smoother 7', [1000, [-8425, 39]], [-257, -248]], ['control: random smoother 8', [30000, [45, -46]], [41, -39]]], [['regression: random smoother 26', [32768, [-4554, -6260, -33961]], [-4554, -6260, -32768]], ['regression: random smoother 27', [30000, [29, 35476, 0]], [27, 30001, 2534]], ['regression: random smoother 32', [30000, [-38866, -29411, -4388, 9, 39, -36]], [-30000, -29461, -6506, -541, -10, -34]], ['control: random smoother 10', [32768, [-12, -3127, -26, -45, -25]], [-12, -3127, -26, -45, -25]], ['control: random smoother 13', [8192, [-8, -27561]], [-2, -6892]], ['control: random smoother 14', [24576, [-12991, -22604, 32, -18621, -30, -36, -10331]], [-9743, -19389, -4823, -15171, -3815, -981, -7993]], ['control: random smoother 15', [30000, [13636, -12457, -1, -11, 49, 0]], [12484, -10350, -875, -84, 38, 3]]], [['regression: random smoother 31', [1000, [-31930, 15, 3, -6, -36514]], [-974, -944, -915, -887, -1860]], ['regression: random smoother 32', [30000, [-38866, -29411, -4388, 9, 39, -36]], [-30000, -29461, -6506, -541, -10, -34]], ['regression: input beyond range', [16384, [40000, 40000, -40000]], [16384, 24576, -4096]], ['control: random smoother 16', [8192, [-12962, 19012, 49, -24286]], [-3240, 2323, 1755, -4755]], ['control: random smoother 17', [16384, [-8485, -763, -9, 25855, -11982, -28816, 38]], [-4242, -2502, -1255, 12300, 159, -14328, -7145]], ['control: random smoother 18', [24576, [-8497, -36]], [-6373, -1620]], ['control: random smoother 20', [16384, [6, -12155, -29083, 31]], [3, -6076, -17579, -8774]]]]
for label, args, expected in fixtures[N-1]:
    check(label, 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
regression: input beyond range[16384, 24576, -4096][16384, 24576, -4096]Passed
regression: random smoother 0[-6, -24577, -6116][-6, -24577, -6116]Passed
regression: random smoother 9[-32768, -22144, -45][-32768, -22144, -45]Passed
control: negative step[0, 0, 0][0, 0, 0]Passed
control: alpha one[100, -5, 7][100, -5, 7]Passed
control: alpha zero[0, 0][0, 0]Passed
control: bad alphabad-alphabad-alphaPassed

SHA-256 / f5047c18062b14389746c21497086b87af1c15b6e12cb66be6d6259eab803f2c

Verification & scope

A deterministic bounded teaching model with a stipulated toy contract; exact rational arithmetic or fixed-decimal rounding keeps outputs strict JSON. It is not a production DSP library and claims no standards conformance. 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:51:36.343930+00:00.

Case digest / db34ab14c74e52e67d28cd173d0eae6983699a738ebb190254ea809e0f9d0eb1