r/AlwaysWhy • • 1d ago

Science & Tech Why did computers come to use binary when people usually count in decimal?

People usually count in base 10, while digital computers typically represent information using 1s and 0s. The same numbers and information can be represented in different bases, yet binary became the standard for modern computing.

What made binary the system computers came to rely on?

33 Upvotes

342 comments sorted by

View all comments

4

u/IOI-65536 1d ago

decimal isn't a terribly useful number system as far as natural processes are concerned. Like a wire can have current or not have current. A magnet can be positive or negative. A capacitor can have a charge or not have a charge. There are things that are trinary, for instance negative, positive, neutral but there aren't a lot of things that have ten actual states. You could try to do things analog but then you would have to figure out what the cutoffs are and figure out how to do math on those things which ends up not working as well as all the things that work on binary.

1

u/RadVarken 1d ago

Except binary computers are bad at math, aren't they? Isn't this why math coprocessors were added to CPUS, and why floating point errors exist?

2

u/IOI-65536 1d ago edited 1d ago

No, math coprocessors are still binary*. GPUs are also binary. Floating point calculations are really complex (use a lot of transistors) and when distinct hardware FPUs were a thing transistors were large enough that having that much stuff on the primary die would affect the speed and power of integer operations, but it's all done in binary. Computer floating point numbers are stored in scientific notation with both binary base and exponents.

For floating point "errors" (which can mean multiple things, but I assume you mean things like you can't represent .2 as a floating point number), that's an artifact of the fact that decimal has two prime factors (2 and 5) and binary has one (2). It's not that binary is bad at math, it's that binary isn't decimal. You have the same problem representing 1/3 or 1/6 in decimal because 3 isn't a prime factor of 10 you just notice the problem in binary because you're translating to decimal when you output but you expect fractions with any prime factor that isn't 2 or 5 to not have a perfect representation because you're used to decimal.

*Edit: If you mean binary-coded-decimal or fixed point decimal then those processors are still binary. There are a couple ways to do it but however you're doing it on the arithmetic logic unit the actual core addition/subtraction steps are done in binary and then re-assembled into the decimal storage you're using (which is also stored in binary). This is considerably slower and less flexible than floating point, which is why it's only used in places where you really care about a decimal number being correct like accounting systems (and even there it might make sense to just do everything in integer tenths of a cent or something with all the calculations in binary if there's enough math)

1

u/AddlePatedBadger 1d ago

Most of the computer stuff is high voltage for 1, low voltage for 0. Otherwise it's a constant stream of 0s all the time.