Faster floating point math with Rust's new API
3 hours ago
- Floating point math is slower than integer math due to compiler conservatism to preserve exact results.
- Rust 1.98 introduces algebraic operators (e.g., `algebraic_add`) that allow compiler optimizations for floats.
- Pairwise summation with algebraic operators can match or beat NumPy speed while maintaining accuracy.
- Algebraic operations enable SIMD optimizations, reducing CPU instructions per value significantly.
- Combining strict and algebraic operators in algorithms balances performance and numerical precision.