Skip to content

Educational course teaching fixed-point arithmetic from first principles. Strict C99, no dependencies, MIT licensed.

License

Notifications You must be signed in to change notification settings

SpeyTech/fixed-point-fundamentals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fixed-Point Fundamentals

Fixed-Point Fundamentals

Learn fixed-point arithmetic from first principles.
When floating-point isn't an option, you need to know this.

License: MIT Standard: C99 Lessons: 8


Why Fixed-Point?

Floating-point arithmetic is convenient but problematic:

  • Non-deterministic — results vary across platforms (x87 vs SSE vs ARM)
  • Accumulation drift — small errors compound over time
  • Certification challenges — hard to prove bounds for safety-critical systems

Fixed-point gives you:

  • Bit-identical results — same answer on every platform, every time
  • Bounded errors — you know exactly how wrong you can be
  • No special hardware — just integers, which every CPU handles identically

Math → Structs → Code

Core Principle: Prove first, code second.


Course Structure

Lesson Topic What You'll Learn
00 Why Not Float? Real failures, why IEEE 754 surprises you
01 The Model Q notation, representation, range vs precision
02 Arithmetic Add, subtract, multiply, divide — done right
03 Safety Handling the edges without undefined behaviour
04 Rounding Truncation, round-half-up, round-to-nearest-even
05 Conversion Moving between representations safely
06 Patterns PID controllers, filters, accumulators
07 Strategy Decision framework for real projects

Each lesson includes working C99 code you can compile and run.


Quick Start

git clone https://github.com/SpeyTech/fixed-point-fundamentals.git
cd fixed-point-fundamentals
make

Each lesson is self-contained. Start with lesson 00, or jump to what you need.

Prerequisites: C programming, basic arithmetic, a C compiler. No external dependencies.


Who Is This For?

  • Embedded engineers moving from floating-point to fixed-point
  • ML deployment engineers targeting hardware without FPUs
  • Safety-critical developers needing deterministic arithmetic
  • Anyone who's been bitten by floating-point "surprises"

Reference Materials


The Certification Bridge

From Teaching to Production

This course teaches concepts with standalone, copy-paste-friendly code.

For production safety-critical systems, certifiable-inference provides bit-identical inference across platforms, Merkle audit trails, and DO-178C / IEC 62304 / ISO 26262 alignment.

Learn the fundamentals here. Build certified systems there.


Related Reading

Articles exploring these concepts in depth:


Related Projects


License

MIT — use it however you like.


"Fixed-point is not a limitation. It's a commitment to correctness."

William Murray — SpeyTech
Building deterministic systems in the Scottish Highlands.

If even one person finds this useful, it was worth writing.