well, the shortest answer is : the do maths very well, thanks for asking.
the more helpful answer is that the rules for binary are basically the same, its just a different annotation system. 1010 and ten are the same value, expressed differently. adding 1 to them still gets you to eleven, even if its written as 1011. doubling that figure gets you to twenty two/10110, etc, etc.
computers tend to do the same basic math, just REALY REALLY FAST. that lets then do complex math fast, which in turn lets them do…well. everything they do.
The computer has logic circuits that are dedicated to quick adding, subtracting, etc. the numbers are represented in binary. The number 1 in binary is 0001, number 2 in binary is 0010. Add the binary numbers together and you get 0011 which is the number 3. The logical circuits handle this type of calculation and there are millions of these circuits in a computer.
There’s a simple circuit out there (a AND b; a XOR b), that has inputs and outputs. When representing a ‘high voltage’ with a 1 and a ‘low voltage’ with a 0, the table for its in/outputs are below:
a,b | Out
–|—
0,0 | 0,0
0,1 | 0,1
1,0 | 0,1
1,1 | 1,0
Now, if you change the name of the second column to ‘a+b’, you’ll notice that the Out column already equals the answer to a+b (when converted to binary). And this is all with just electricity!
Computers have a bunch of similar circuits inside of them. Some are for adding numbers together, some are for adding *more complex* numbers together, some are for multiplying numbers. But in the nitty gritty, it’s circuits that have inputs and outputs that behave like arithmetic.
Latest Answers