Skip to main content
← Lab

neonbf16

confirmedC++ · NEON / Apple M4Systems & data structuresJuly 9, 2026

the question

f32->bf16: is round-to-nearest better than truncation, and is a hand-written NEON kernel worth it?

what came out

Round-to-nearest-even is exactly one bit more accurate than truncation (max rel error <=2^-8 vs <=2^-7) and free. But hand-writing a NEON kernel buys nothing (0.97-1.02x) -- the compiler already auto-vectorizes the bit-twiddle. Hand-SIMD only pays against an auto-vectorization barrier. asm-confirmed.

method & receipts

→ read the code and re-run it

github.com/v-code01/neonbf16