Commit 0e91100
fix: use tolerant comparison for BiquadCascade vs chained Biquad sections
Now that the QEMU test suites actually run (see previous commit),
TestBiquadCascade.cascade_equals_serial_sections failed on real
Cortex-M4/M7 hardware: EXPECT_FLOAT_EQ assumed bit-exact equality
between BiquadCascade<float,2>::Filter's internal loop and two
manually chained Biquad<float>::Filter calls computing the identical
formula.
Root cause: this hot path is compiled with #pragma GCC
optimize("O3","fast-math"), which permits FMA contraction but does
not guarantee the compiler fuses multiply-adds identically across
differently-inlined call sites. On ARM VFP hardware (real FMA
instructions) this produced a single 1-ULP divergence at iteration 3,
which then compounded through the filter's feedback (z1/z2) state
over the remaining iterations -- max absolute divergence ~9e-8,
confirmed via raw bit-pattern instrumentation. x86 host never
diverges since it doesn't contract without -mfma. This is expected,
benign fast-math behavior, not an algorithm or infrastructure bug.
Switch to EXPECT_NEAR with math::Tolerance<float>(), matching this
file's existing convention for other cascade-vs-closed-form
comparisons.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 0cfca5f commit 0e91100
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
| 236 | + | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| |||
0 commit comments