Repository navigation
Compare libm easings within 1e-15 on every glibc - #58
chessing234 wants to merge 1 commit into
Conversation
glibc picks an FMA or SSE2 libm at runtime, so bit-exact goldens recorded on an FMA machine fail on a CPU without FMA even when CPython matches. Polynomials stay bit-exact. Fixes #56
|
Reviewed at b95d1f8 by Claude Opus 5.5, with a second opinion from Codex Medium and muse-spark-1.3-contributor (via pi, thinking high). The bug is real and this does fix it. On a disposable x86_64 worker (FMA and AVX2, glibc 2.44), But on the pinned platform the 1e-15 absolute bound also hides real transcription regressions. I seeded rewrites in
Nothing else in the suite stands in for it. I ran the effect parity suite against each mutant: the InExpo one is caught by The measured libm difference is far narrower than the bound. Without any mutation, the SSE2 libm moves one or two samples per easing: 1 ulp for OutSine and InOutElastic, 1 ulp for CubicBezier(0.25, 0.1, 0.25, 1.0) (also seen on the FMA worker in release, the LLVM const-folding case the old comment explained), and at most 17 ulp on two samples of CubicBezier(0.68, -0.55, 0.265, 1.55). A per-class ulp bound, roughly 1 ulp for the sine, expo, circ and elastic easings and something near the measured 17 for the beziers, would pass on both libm variants and still reject all three mutants above. Both reviewers also looked at gating bit-exactness on Smaller points, none blocking on their own:
Codex and muse both raised the hidden-regression point. They agreed with measurements I gave them, so read that as agreement, not independent confirmation. Both independently flagged that the list's rationale contradicts CubicBezier's own code, and that CPU-feature gating fails under the tunables reproduction. A claim from muse that 17 ulp "is about 3.8e-15, not 2.4e-16" was wrong and is dismissed: the sample is about 0.083, where 17 ulp is 2.36e-16, as the PR says. CI did not run on this pull request. What happens next is up to @chessing234 and the maintainer: the bug needs fixing, and the question is whether a tighter ulp bound should replace the 1e-15 tolerance on Linux/glibc. |
easing_matches_python_bit_exactlytreated every glibc as one libm. glibc picks an FMA or SSE2 variant at runtime, and the goldens were recorded on an FMA machine. On a CPU without FMA, OutSine and InOutElastic differ by 1 ulp and one cubic bezier by about 2.4e-16. CPython on that same CPU matches the Rust result.Polynomials stay bit-exact. sin, cos, sqrt, non-integer powers, and cubic beziers use the 1e-15 absolute tolerance other libcs already use.
Fixes #56
Ran the golden test here. This machine is macOS, so it takes the tolerance path rather than the glibc bit-exact path.
Made with Cursor