E-Ink News Daily

Back to list

Implementing FMA and finding bugs in C and Rust standard libraries

The author implemented a software-emulated FMA (fused multiply-add) using SIMD for machines lacking hardware support, following a formally verified algorithm from a 2008 Coq paper. During testing, they discovered subtle bugs in both Rust's standard library and musl libc that produce incorrect FMA results. Notably, around 15% of machines in the Firefox hardware survey lack AVX2 with hardware FMA, making accurate emulation essential.

Background

Fused multiply-add (FMA) is a fundamental floating-point operation that computes a*b+c with a single rounding step, crucial for accurate mathematical functions like sin/cos. Many systems lack hardware FMA support, requiring software emulation via SIMD instructions.

Source
Lobsters
Published
Sep 3, 2026 at 12:19 AM
Score
7.0 / 10