eli5 How do calculators work?

251 views

eli5 How do calculators work?

In: 11

4 Answers

Anonymous 0 Comments

The math humans usually do is done in the base-10 number system, aka decimal. Calculators and computers (really, the same thing) do math using a base-2 number system, aka binary. A decimal number can be represented in binary just fine, 7 in decimal is equivalent to 0111 in binary. Note that in the binary system each digit is either 0 or 1. Now there aren’t actually 0s and 1s running around in computers. Instead, there are wires that have a voltage on them. Circuitry attached to the wires forces the wire’s voltage to be either high, or low. We typically use a low voltage to represent a 0, and we use a high voltage to represent a 1.

If you wish to make a circuit that adds two binary digits, then you just need to design a circuit that outputs a high voltage when only one of it’s two inputs is a high voltage. See the table below.

0 + 0 = 0

0 + 1 = 1

1 + 0 = 1

1 + 1 = 0 (well, really it’s 10)

It’s a bit more complex than that because, just like decimal addition, there are carries. So 1 + 1 does equal 0, but there is an additional output wire that must also be a high voltage in this case because there is a carry to the next binary digit. Being more accurate now, the circuit we seek must have two outputs such as:

0 + 0 = 0 and carry 0

0 + 1 = 1 and carry 0

1 + 0 = 1 and carry 0

1 + 1 = 0 and carry 1 (this is the 10 mentioned above)

So this is how a computer does addition. Subtraction is very similar, we just need to negate one number first, then add similar to above. Negative numbers in binary do exist, but I won’t go into it here. The phrase of interest if you’d like to learn more is 2’s complement.

Hope that made sense. It’d be worthwhile to understand addition, before jumping into multiplication or division.

You are viewing 1 out of 4 answers, click here to view all answers.