ELi5: How do computers do math?

246 viewsOtherTechnology

How do computers do math with binary numbers, or do they?

In: Technology

4 Answers

Anonymous 0 Comments

You can do all the same math in binary, or hexadecimal, or whatever that we do in base 10. For example 8 + 4 = 12 becomes 1000 + 0100 = 1100 in binary. Then the computer would convert 1100 into the base 10 version which is 12.

Anonymous 0 Comments

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.

Anonymous 0 Comments

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.

Anonymous 0 Comments

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.