You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Avoid overflowing intermediate differences in floating-point lerp #556
lerp_f32/f64 uses a + (b-a)*amount. Opposite-sign large finite endpoints can overflow b-a even when the interpolation result is finite. With a=1e308, b=-1e308 and amount=0.5, the midpoint is zero but the formula propagates infinity. At amount=0, the same overflow is multiplied by zero and can yield NaN instead of returning a.
This affects interpolation within [0,1], not only extrapolation outside the endpoints.
Use a numerically stable interpolation path for finite endpoints, preserving exact endpoint results at amounts 0 and 1.
Cover opposite-sign extreme values and finite midpoints for both float widths.
Test monotonicity and ordinary close-endpoint inputs so fixing overflow does not introduce unnecessary cancellation regressions.
Document exceptional-input behavior briefly and keep the implementation independent of libm/libc.
Audit status: static source inspection against canonical master ea74c2dafc31da876e5561f2d176ba719f5a0458 on 2026-09-10. No compiler build, test execution, implementation change or local reproduction was performed for this report. The examples describe the source-derived behavior to verify when implementing the fix.
Activity
fix: preserve numeric results, file data, and I/O deadlines (wavefnd#631