ELSEIF
Your brief EB
1,504 stories from 222 feeds 1277 clusters Refreshed 38 minutes ago next pull 14:30

LANGUAGES Signal 124

Rust and musl libc FMA implementations mishandle subnormal floating-point values

Illustration only Photo by Matt Artz on Unsplash

A developer building a vectorized FMA emulation for the fearless_simd library discovered that Rust's standard library and musl libc both produce incorrect results for subnormal floating-point inputs in their software FMA fallbacks.

WHY IT MATTERS

Software FMA fallbacks run on the 15% of machines in Firefox's hardware survey that lack hardware FMA, primarily Intel parts without AVX2. The bug only manifests on those systems, making it invisible during normal development on modern hardware. Correct FMA is a fundamental building block for numerically stable trigonometric functions and other floating-point algorithms.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

Rust's f32::mul_add and std::simd both incorrectly handle rounding for subnormal values in their software FMA implementations.

02

The bug was caught only because CI ran tests in an emulator simulating systems without hardware FMA, a codepath that never executes on typical developer machines.

03

A formally verified algorithm from a 2008 paper by Boldo and Melquiond computes a*b+c in f64 then rounds to f32 with special subnormal handling, providing a correct replacement.

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
shnatsel.github.io via Lobsters Implementing FMA and finding bugs in C and Rust standard libraries Open ↗