Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Library Documentation Index

Safe Numerics



This library started out as a re-implementation of the facilities provided by David LeBlanc's SafeInt Library. I found this library to be well done in every way. My main usage was to run unit tests for my embedded systems projects on my PC. Still, from my perspective it had a few issues.

Using later versions of C++ and the its standard library, template metaprogramming and Boost libraries I managed to (re)implement similar functionality in under 2000 ? lines of code. I promoted this version as a possible submission to the Boost. The feedback I received convinced me that no such library would be considered acceptable to the large majority of C++ programmers. It seems that the desire for maximum performance overrides any requirement that a program be known to be free of bugs. By this time I had a better idea of the opportunities available with the latest version of C++ (C++14) and resolved to address this issue by creating a library which would provide all the facilities of safe numerics at minimal runtime cost. The result is what you see here. The library now consists of 7000 lines of code, approximately 50 separate tests and more than 60 pages of documentation and examples.

Since I wrote the above, I've been contacted by David LeBlanc. He's been updating his package and informs me that the latest version:

His current package can now be found at in github.