Fixed-point arithmetic in embedded C
Work with scaled integer representations, rounding, saturation and bounds when floating-point is costly.
View lesson accessAll lessonsWhat the lesson covers
The course lesson is called Maths without an FPU. The filter uses floats. On the Cortex-M0 it runs 40 times slower than the budget allows, and the results drift. The fix is to keep the numbers as scaled integers and control the scaling by hand.
- Q format
- scaling
- fixed-point multiply
- rounding
- saturation
Before you start
Question to think about: What precision and range are needed, and where might an intermediate value exceed its type?
Preparation exercise: Specify input bounds and a rounding convention, then compare results against an independent numeric reference.
This is an original public study prompt, not the paid lesson or its solution. The interactive course contains the walkthroughs, labs, exercises and recaps.
Related free reading
Test your understanding
Practice free firmware interview questions and mock interviews · Assess your readiness