# Chapter3Computer Arithmetic¶ permalink

We next turn our attention to a code for storing decimal integers. Since all storage in a computer is by means of on/off switches, we cannot simply store integers as decimal digits. When you get to them, Exercise 3.1.1.1 and Exercise 3.1.1.2 should convince you that it will take some thought to come up with a good code that uses simple on/off switches to represent decimal numbers.

Another very important issue when talking about computer arithmetic was pointed out in Section 2.3. Namely, the programmer must decide how many bits will be used for storing the numbers before performing any arithmetic operations. This raises the possibility that some results will not fit into the allocated number of bits.

As you will see in Section 8.1, the computer hardware provides for this possibility with the *carry condition flag* (`C`) and *overflow condition flag* (`V`) in the `CPSR` register located in the CPU. (A *register* is a small amount of memory, typically 32 or 64 bits, located in the CPU. This will be explained in Chapter 8.) Depending on what you intend the bit patterns to represent, either the carry condition flag or the overflow condition flag (not both) will indicate the correctness of the result. However, some high level languages, including C and C++, do not check the `C` flag and `V` flag after performing arithmetic operations.