eli5 How do calculators work?

In: 11

Id go watch youtube videos on how mechanical calculators work, they existed long before digital stuff.

In essence, they use sequences of 9 tooth gears that have a full revolution of one gear making the next gear go up by 1 that also resets themselves to 0 at that point. You have a master sequence of gears, the output, that stores the results. So you might put in 7 as your first digit, the out put turns to 7 in the same gear (or column when we do it on paper) – the same thing that first gear is set to. You want to add 3, so you set it to add 3 more turns and it flips to 0 and marks the next gear forward a tooth to 1. You now have the output as 10. You then want to add 7 to it again, so you rotate that first gear by 7 and the output now displays 17. You want to add 100 so the third gear goes forward by 1, you now have 117.

It gets more complicated after that with division and multiplication as its doing shifts of positions and you start realizing people are reallllllly clever that came up with this crap.

Calculators are just a type of computer, so they work the same way. See if any of the “how do computers work” posts on this sub answer your question

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.

Since the 1970s, calculators have a very simple computer inside of it, which runs a simple program for doing math. They are very slow (kilohertz) and have very little memory (bytes).

Scientific calculators are a bit more complicated, so they require slightly more powerful processors and more memory. The processing power is still miniscule compared to any kind of normal computer.

Lastly graphing calculators are arguably real computers. Depending on the model, they pack power comparable to a full size computer or even workstation from the 1980s or 1990s. They can often run 3rd party programs which can be downloaded by serial cable, usb, or even wirelessly on some models. The main thing holding graphing calculators back is that they are usually designed to comply with the rules for standardized tests, which limit the amount of functionality they are allowed to have.

For instance, the TI-84 uses a Z80 processor, which is similar (but faster) than the ones used in the Tandy TRS-80 home computer or the Nintendo Gameboy. The TI-89 uses a Motorola 68000 processor, which was used in high-end Unix workstations in the early 1980s, as well as being used in the Sega Genesis. Some of the new TI nSpire calculators use ARM processors running at hundreds of megahertz, which probably compare favorably to a Pentium II or Pentium III computer from the 1990s.