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?

884 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 are a fan of this subject and would like a deeper understanding of exactly how a computer operates, I’d recommend a game on steam called Turing Complete. You literally build everything yourself. They start you out with 1 single logic gate, the nand gate. Then the game prompts you to create other gates that have a specific function, but they are only made from the nand gate or from the gates you yourself created with the nand gate. It keeps asking you to do increasingly more complex things until you literally build and wire a turing complete computer from just nand gates. If you’re determined, a person with 0 computer science knowledge can learn to build a computer from scratch. The game doesn’t tell you how any of it works, it makes you figure it out with some helpful hints. This way you won’t just have basic knowledge, but also the understanding of the knowledge to back it up. You will 100% understand how a computer calculates based on instruction, because you will be building the hardware architecture yourself, and writing the assembly code that makes it function.

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