FA-91607 / Digital signal filters / Member archive
Coefficient quantizer allows the positive code 2^(B-1) · case 02
A coefficient of 1.0 in Q7 yields code 128, which does not fit in eight bits.
Case contract
Input [coeffs, f, B, mode]: quantize each decimal coefficient to a B-bit two's-complement code with f fractional bits; "nearest" rounds half away from zero, "truncate" floors. Codes saturate to [-2^(B-1), 2^(B-1)-1]. Return {"codes", "saturated": count of clipped codes, "max_error": max |code/2^f - c| after saturation as a fraction string}.
Why this case matters
Coefficient quantization decides whether a fixed-point filter still meets spec; rounding and saturation slips shift poles.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: random quantize 29 | {"codes": [8, -3, 8], "max_error": "3/50", "saturated": 0} | {"codes": [7, -3, 7], "max_error": "267/1000", "saturated": 2} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗