---
# System prepended metadata

title: 'What is an FPU (Floating-Point Unit), and when is it needed?'
tags: [Microcontroller]

---

An FPU (Floating-Point Unit) is a specialized part of a [microprocessor](https://www.ampheo.com/c/microprocessors) that performs floating-point arithmetic operations—like addition, subtraction, multiplication, and division—on real numbers (with decimals).
![fpu-acronym-floating-point-unit-260nw-2424241619](https://hackmd.io/_uploads/r1r26Qt4gl.png)


 **What Is Floating-Point Arithmetic?**
Floating-point numbers represent real numbers (e.g., 3.14, -0.001, 2.718) in a format that allows a wide range of values.
They're commonly used when:

* High precision is required
* Very small or very large numbers are involved
* Decimal calculations are necessary

 **What Is an FPU?**
 FPU = Hardware component that accelerates math operations involving:
* float (32-bit floating-point)
* double (64-bit floating-point)
* Scientific or engineering computations

 **Why and When Do You Need an FPU?**
 **You need an FPU when your application includes:**
![企业微信截图_20250625155627](https://hackmd.io/_uploads/ByThjQYElg.png)

 **Without an FPU?**
If your MCU has no FPU, floating-point operations are done in software, which is:

* Much slower
* More power-hungry
* Larger in code size

Example: An [STM32F103](https://www.ampheo.com/search/STM32F103) (Cortex-M3, no FPU) is much slower at float math than an [STM32F407](https://www.ampheo.com/search/STM32F407) (Cortex-M4, FPU).

 **STM32 Example**
![企业微信截图_20250625155710](https://hackmd.io/_uploads/BJTlnXFExe.png)

 **Summary**
![企业微信截图_20250625155800](https://hackmd.io/_uploads/Hy9GhXYVxx.png)
