AdvancedTopic 91 of 104Electronics & Embedded

Fixed-point arithmetic

Integer scaled maths used on devices without a floating-point unit.

In depth

Without an FPU, fractions are stored as scaled integers in Qm.n format, e.g. Q15: value=int/32768. Multiplication needs shifts; watch overflow and rounding. Faster and smaller than software floating point but requires careful scaling.

Key points

  • Q-format notation
  • Saturate on overflow
  • Integer division is slow
Example

A PID loop uses Q16.16 arithmetic on a Cortex-M0.

Why it matters

Fixed-point arithmetic lets small processors do fractional maths efficiently, and it is still used in many embedded and audio systems.

Where this is used

  • Implementing a filter on a microcontroller without a floating-point unit.
  • Scaling sensor values to Q15 format for a DSP routine.
  • Converting a temperature reading to degrees with integer maths.

Frequently asked questions

What is Fixed-point arithmetic?

Integer scaled maths used on devices without a floating-point unit.

Why is it important to understand fixed-point arithmetic?

Fixed-point arithmetic lets small processors do fractional maths efficiently, and it is still used in many embedded and audio systems.

What is Q format?

A notation that sets how many bits are fractional, such as Q15 where the value is an integer divided by 32768.

What is the main risk with fixed-point?

Overflow and loss of precision, so scaling and saturation must be designed carefully.

How is Fixed-point arithmetic used in practice?

Typical applications include implementing a filter on a microcontroller without a floating-point unit, scaling sensor values to Q15 format for a DSP routine and converting a temperature reading to degrees with integer maths.

What should I learn before Fixed-point arithmetic?

Study "Digital signal processors" first (topic 90 of 104 in Electronics & Embedded). It covers the groundwork this topic builds on.

What are the key points of Fixed-point arithmetic?

Q-format notation. Saturate on overflow. Integer division is slow.

Can you give an example of Fixed-point arithmetic?

A PID loop uses Q16.16 arithmetic on a Cortex-M0.

What comes after Fixed-point arithmetic?

The next topic is "Embedded security", which builds directly on this one.

How difficult is Fixed-point arithmetic?

It is classed as Advanced in Electronics & Embedded (topic 91 of 104). It is an advanced topic. It assumes you are comfortable with the intermediate topics in Electronics & Embedded.

Learning path

Want to practise? Open the interactive course for quick checks, quizzes, simulations and progress tracking.

Related topics