Home Downloads Errata Buy Contact

From Mathematics to Generic Programming (FM2GP) is a 2015 book from Addison-Wesley.

book cover design

Sample Chapters

Chapter 1: What This Book Is About   PDF icon

Chapter 3: Ancient Greek Number Theory   PDF icon

Code Examples from Book

For each chapter listed below, there is a .h file and a .cpp file. The .h files contain the functions that actually appear in that chapter. The .cpp files contain very simple tests that exercise those functions. Note that not every chapter in the book contains code.

Chapter 2    ch02.h    ch02.cpp
Chapter 3    ch03.h    ch03.cpp
Chapter 4    ch04.h    ch04.cpp
Chapter 7    ch07.h    ch07.cpp
Chapter 8    ch08.h    ch08.cpp
Chapter 10    ch10.h    ch10.cpp
Chapter 11    ch11.h    ch11.cpp
Chapter 12    ch12.h    ch12.cpp
Chapter 13    ch13.h    ch13.cpp

You may also download all the files as a compressed tar archive.

You will need to compile with the following flags: -stdlib=libc++ -std=c++11
if these are not your compiler's default library and language version settings already.

Course Materials

The following materials are available for instructors who wish to teach a course based on the book:

Note to Instructors    PDF
Course Slides, Part 1 of 3    PDF    PPTX
Course Slides, Part 2 of 3    PDF    PPTX
Course Slides, Part 3 of 3    PDF    PPTX