Performing calculations on integers is one of the most fundamental tasks in any programming language. As such, the properties of integer arithmetic are often taken for granted. In this talk we will take a step back and re-evaluate how integer arithmetic is handled in C++.
We will start by taking a look at how integer arithmetic is commonly performed in hardware and how that differs from the rules used by the C++ language. We will then identify certain areas where the language rules turn out to be problematic, in particular for authors of numerical libraries. This will lead us to a more durable form of integer arithmetic. We will discuss hypothetical implementations of such a durable arithmetic on both language and library levels and explore the implications for numerical applications such as rational numbers, arbitrary precision integers and safe integers. We will look at some of the challenges that an implementation will have to overcome to enable efficient code generation and give an overview of how WG21 tries to address these challenges in some of its current proposals.