PART 4 / LESSON 25 · Overview free · interactive lesson in the full course

Fixed-point arithmetic in embedded C

Work with scaled integer representations, rounding, saturation and bounds when floating-point is costly.

View lesson accessAll lessons

What 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.

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