Since processors and digital electronic systems in general operate solely on binary digits called bits, number processing requires coding.
The different representations involve several aspects:
format presentation ;
basic arithmetic operations (addition, subtraction, multiplication, division) with the possible problems of overflow;
instruction sets for the various operations, with variations depending on the instruction set.
The n-bit integer formats represent unsigned or signed integers. While positive numbers always have the same representation, different representations of negative numbers have been defined: sign and absolute value, complement to 1, complement to 2, the latter being the only one used for decades. For integer operations, the number of output bits is different from the number of input bits. An n-bit + n-bit addition produces an n+1-bit result, and an n-bit * n-bit multiplication produces a 2n-bit result. Dealing with carry (addition) or n most significant bits (multiplication) poses problems for both scalar instructions and SIMD instructions in the various instruction sets.
Single-precision (32-bit) and double-precision (64-bit) float formats have been standardized since the mid-1980s (IEEE 754). They are presented here, along with the more recent reduced 16-bit and 8-bit formats used in deep neural networks. Block float and decimal float formats are also presented. The Posit format, proposed by J.L. Gustafson as an alternative to IEEE 754 float formats, is presented and discussed.
While integer and float formats have been used in general-purpose processors for decades, computational models such as neural networks and energy consumption issues have led to the emergence of reduced formats that can be added to certain general-purpose instruction sets, or implemented in specialized processors, IPs, FPGAs and so on.