Eli5 Calculators, how do they work?


How do calculators work? Like the device, not a calculator app. Help!

In: 0

Calculators are just simple, simple computers.

All computers operate on some basic principles…

There is an input (usually from a user).

The software then tries to make sense of that input.

The software then comes up with the appropriate output for the given input.

In a word processor app, the inputs are the letter themselves, and the output is displaying the text on the screen.

In a web browser, the inputs are clicking on links, and the output is opening a new web page.

In a game the inputs are the game controls, and the outputs are the corresponding in-game actions.

On a calculator, the inputs are the numbers and mathematical functions, and the outputs are the solutions.

The software of a calculator is basically just a basic blueprint of how to math in the simplest computer language.

So you input a math problem, and the calculator outputs an answer.

Anything that the software can’t understand results in an error.

You have two light switches to control a single bulb. They’re wired so that if either switch is ‘on’ then the bulb will be on. This is a simple comparison, which can be simplified to “If switch 1 or switch 2 is on, then the bulb is on”.

Now we use electronic switches – instead of a bulb we have another switch connected to more switches down the line. We can make huge chains of switches that can compare any number of inputs and create countless outputs.

So we chain these switches in a way that will add binary numbers together. Just like addition with digital numbers, binary numbers follow simple rules (add the first digit, carry remainder to the next digit, repeat).

This is the “adder” part of the calculator.

Next we have a clock. It automatically flips one switch over and over again, and this tells the calculator when it can move on to the next step. We need this for multiplication – a collection of switches will do addition over and over again every cycle of the clock until it has finished doing the multiplication.

Everything else can be simplified down to repetition (controlled by the clock and counting switches) and addition (controlled by the adder). Subtraction and addition work the same way, and division is done a lot like multiplication.

You can make more circuits like the adder, to do things faster, since repetitively adding things can take a while when you’re doing complex math. That’s the gist, though.

Modern calculators use integrated circuit, so they’re effectively just mini-computer. The integrated circuit support general-purpose programming, so anything you want it to do, you can program it to do so, only limited by what a computer can do, and its more limited memory. So it’s not much different from a calculator app.