Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

A basic calculator can perform a wide variety of operations. How does the claculator 'get' the concept of adding two numbers in the same way a human does? I dont think people that make claculators store every possible result of every possible addition on the chip before shipping it. Soemhow the chip needs to 'learn' how to add.

I mean if I were to start with a blank slate(chip) and 'teach' the chip to perform calculations(additions), how do i go about it? Do i need to learn artificial nural networks first?

share|improve this question

closed as unclear what you're asking by user61852, Robert Harvey, MichaelT, JeffO, Thomas Owens Jul 11 '13 at 20:27

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
A pocket calculator uses logic circuits to calculate numbers. It doesn't 'get' anything. If you want to start with an AI and teach it the concept of arithmetic, that's a completely different thing from your pocket calculator. –  FrustratedWithFormsDesigner Jul 11 '13 at 17:57
    
Look here: en.wikipedia.org/wiki/Adder_%28electronics%29 –  Doc Brown Jul 11 '13 at 17:58
    
Thanks. I can understand logical circuits for addition, but what about complex operations in a scientific calculator like the derivative of a function? or the std deviation? –  Kaushik Jul 11 '13 at 18:07
2  
How do you get the result of, say 12 + 24, yourself, using a piece of paper? Do you have a table that has every possible result of every possible addition? No, you use an algorithm ( a series of steps) to perform the calculation. Same thing with calculators. Algorithms to compute derivatives or std deviation work the same way; they're just a bit more complex than the addition calculation, that's all. –  Robert Harvey Jul 11 '13 at 18:15
1  
@Kaushik still hardware. The VAX even had a hardware set of instructions to do polynomial evaluation. Odd/complex vax instructions - the POLYx instruction. In hardware, designed by humans. No machine learning or anything strange like that. –  MichaelT Jul 11 '13 at 18:17

1 Answer 1

up vote 7 down vote accepted
  1. Work in binary: 0, 1, 10, 11, 100, 101...

  2. Know your math: 0+0=00, 0+1=01, 1+0=01, 1+1=10

  3. Know your logic: or, and, not, xor...

  4. Find that the low bit is a XOR and the high bit is a AND.

  5. Expand the principle of one bit to 8, 16, 32, 64 bits

  6. Build it with logic gates.

enter image description here

If you want to know more, see my answer to How is fundamental mathematics efficiently evaluated by programming languages?

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.