How Does A Computer Calculate Numbers?

Computers turn every number into binary. The numbers that we use are expressed in base 10. Every 10 1s equals 1 ten, every 10 tens equals 1 hundred, and so on. In binary, you go up a unit every 2 numbers. So 2 ones equals 1 two, 2 twos equal 1 4, and so on. For example, the number 9 would be 1001 in binary: 1 one, 0 twos, 0 fours, and 1 eight. 1 + 8 =9. Computers do this because it is easier to design circuits that only have values of 1 or 0 than circuits with 10 separate values each.

Advertisement

Addition

Computers have basic mathematical operations like addition and subtraction programmed into them. Adding in binary is extremely simple. If you have 2 numbers with a 1 value, you store a 0 and move carry 1. Otherwise, you record the bigger of the two numbers in that slot. For example, if you are adding 5 + 4, you get: 0101 + 0100. In the first slot, you have a 1 + 0, so you store the bigger number, 1. In the second slot, you have two 0s, so you store 0 (since both numbers are the same. In the third slot you have two 1s, so you store a 0 and carry a 1. You end up with the number 1001, or 9.

Advertisement

Multiplication.

Computers use long multiplication, but they do it in binary. If the computer multiplies a number by 1, it returns a 1. This is a much simpler system than base 10, even though it does require more steps. For example, in base 10 the problem 8 * 9 is an easy, 1-step problem with no long multiplication. However, in binary each number is 4 digits long, and the solution is 7 digits long!

Advertisement

Subtraction

Subtraction is done in two steps. Rather than subtracting a number, a binary computer adds its compliment, a number with ones where the original has zeros, and zeros where the original has ones. For example, whereas 4 is 0100 in binary, negative 4 is 1011. So, for 7 – 4, we get 0111 + 1011 = 10010. The number at the leftmost side is then moved to the right, giving us 0011 = 3.

Advertisement

Cite This Article

MLA

David, Isaiah. "How Does A Computer Calculate Numbers?" sciencing.com, https://www.sciencing.com/computer-calculate-numbers-4705975/. 24 April 2017.

APA

David, Isaiah. (2017, April 24). How Does A Computer Calculate Numbers?. sciencing.com. Retrieved from https://www.sciencing.com/computer-calculate-numbers-4705975/

Chicago

David, Isaiah. How Does A Computer Calculate Numbers? last modified August 30, 2022. https://www.sciencing.com/computer-calculate-numbers-4705975/

Recommended

Advertisement