Eli5: Computers can calculate based on instructions. But how do you teach computers what does it mean to add something, multiply, divide, or perform any other operation?

930 views

Edit: Most of the answers here are wonderful and spot on.

For those who interpreted it differently due to my incorrect and brief phrasing, by ‘teaching’ I meant how does the computer get to know what it has to do when we want it to perform arithmetic operations (upon seeing the operators)?

And how does it do it? Like how does it ‘add’ stuff the same way humans do and give results which make sense to us mathematically? What exactly is going on inside?

Thanks for all the helpful explanations on programming, switches, circuits, logic gates, and the links!

In: 583

43 Answers

Anonymous 0 Comments

People are correct in saying you don’t teach it, but I think that misses something important, which is that you find things in “nature” that can be used to do addition. Just like you can use falling sand in an hourglass to tell time, you can use electricity in circuits to perform addition. If you arrange the circuits in a specific configuration (called a binary half adder) you can input electrical signals representing two binary digits and get the output of their sum. That being said, there is nothing requiring that computers be made of electronics, anything that can be used to do binary logic (e.g. turns on and off in response to something else being on and off) can be used to make an adder. There are videos of people making adders from marbles and dominoes. Electric circuits are used because they are much faster than anything else we can currently use. In the future we may have computers that use light for doing calculations instead.

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