[a] This makes it unpleasant to deal with in abstract mathematics, but it has an important role to play in digital hardware and algorithms where values have maximum and minimum representable ranges.
In hardware, modular arithmetic with a minimum of zero and a maximum of rn − 1, where r is the radix, can be implemented by simply discarding all but the lowest n digits.
In the words of researchers G. A. Constantinides et al.:[1] When adding two numbers using two's complement representation, overflow results in a "wrap-around" phenomenon.
Saturation arithmetic for integers has also been implemented in software for a number of programming languages including C, C++, such as the GNU Compiler Collection,[2] LLVM IR, and Eiffel.
On the other hand, on simple 8-bit and 16-bit CPUs, a branching algorithm might actually be faster if programmed in assembly, since there are no pipelines to stall, and each instruction always takes multiple clock cycles.
[3] Although saturation arithmetic is less popular for integer arithmetic in hardware, the IEEE floating-point standard, the most popular abstraction for dealing with approximate real numbers, uses a form of saturation in which overflow is converted into "infinity" or "negative infinity", and any other operation on this result continues to produce the same value.
This has the advantage over simple saturation that later operations decreasing the value will not end up producing a misleadingly "reasonable" result, such as in the computation