Proposals Unofficial Go proposal tracker

Add FMA32 for single-precision fused multiply-add

#82653 · math · low impact · Implemented in Go 1.28 ·

Go has no correct, fast way to compute a single-precision fused multiply-add. The obvious float32(math.FMA(float64(x), float64(y), float64(z))) rounds twice: once to float64 and again to float32. That can give a different result from a true fused operation. Writing x*y + z may compile to a fused instruction, but the spec allows this without requiring it, so results vary by platform and compiler.

The proposal adds math.FMA32. It computes x*y + z as if with infinite precision and rounds only once:

func FMA32(x, y, z float32) float32

r := math.FMA32(a, b, c) // a*b + c, rounded once to float32

Like math.FMA, the compiler turns it into a single inlined hardware instruction where one is available. This covers arm64, loong64, ppc64x, riscv64, s390x, amd64 (with FMA support) and arm (with VFPv4). On 386, mips and wasm it uses a pure-Go software fallback.

Proposal
#82653 by aclements
Status
Implemented on Nov 4, 2026
Release
Go 1.28
Impact
low
Area
math