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?

918 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

If you really want to know look into half and full adders: [https://www.elprocus.com/half-adder-and-full-adder/](https://www.elprocus.com/half-adder-and-full-adder/)

But the quick version is, do you know these japanese bamboo water decorations? Where one bamboo stick fills with water until the weight makes it turn and all the water spills, partly into a second bamboo stick, etc?

If, let say, each bamboo stick needs 3 spillage cycles to get the next bamboo stick to fill up and spill, then you basically have an water based digital counter circuit that operates in base 3. An empty or completely, therefore in the progress of spilling, full bamboo stick would be the “0” and 1/3 and 2/3 full would be “1” and “2” and after 4 “ticks” you could read the number 011 (in base 3) off those bamboo sticks, which is the number 4 in base 10. So we “taught” the bamboo sticks to cound.

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