← Back to the chapter

Technical detail · Fixed-Point Arithmetic

Under the Hood: accidental double precision

The energy case for fixed-point depends entirely on the core. On a Cortex-M4F, or an M7 configured with a single-precision FPU, a float multiply is nearly as fast as an integer one, so fixed-point’s energy edge for single-precision work largely disappears and its accuracy pitfalls may not be worth it. The decision must follow the hardware, not a habit.

On a core with only a single-precision FPU, double-precision work is a trap. A stray double-precision operation is still emulated in software, at a cost like the FPU-less case. An unsuffixed C literal has type double, so y = x * 0.5 promotes x to double and can require software double arithmetic on that target, whereas y = x * 0.5f stays in the hardware FPU. The same trap appears when a program calls sin instead of sinf, or assigns to a double variable. A design that expected the FPU to keep compute cheap can quietly fall back to slow software doubles, inflating active time and energy exactly as if the FPU were not there. The practitioner habit is to confirm the core, keep hot math single-precision with f-suffixed literals and single-precision library calls, and reserve fixed-point for FPU-less parts or for squeezing the last cycles.

The audit evidence is concrete. In a Cortex-M4F build, hot-path disassembly should show single-precision FPU instructions such as vmul.f32 or calls to single-precision helpers, not double-precision software routines. A map file that pulls in helpers such as __aeabi_dmul, __aeabi_dadd, or conversions between double and float is a warning that part of the numeric path escaped the hardware FPU. That evidence decides whether fixed-point is solving a real energy problem or merely adding scale-management risk.

← Back to the chapter