An exact floating-point check passes on the Mac and fails in the aarch64 GCC 12 container because of FMA contraction
PitfallVerified 5 Oct 2026Holds project: dftracer-utils
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.
Symptom#
tests/dataframe/test_frame_window.cpp failed only in the GCC 12 container (docker-test-gcc12), by one bit in a quantile interpolation.
Cause#
GCC contracts a*b+c into a fused multiply-add on aarch64 by default (-ffp-contract=fast), and the container is aarch64 on an Apple Silicon host. The macOS Clang build rounds the multiply and the add separately, so the results differ in the last bit.
Fix#
Allow about 4 ulp in the test instead of exact equality. Do not treat such a failure as a logic bug in the kernel; check first whether FMA contraction explains it.
Evidence#
Fixed in the working tree change to tests/dataframe/test_frame_window.cpp (2026-10-05).
Also found by searching
- test_frame_window fails only in the GCC 12 container by one bit
- exact check_close fails on aarch64 GCC but passes on macOS Clang
- -ffp-contract=fast fused multiply-add changes last bit
- quantile interpolation differs by one ulp between compilers