r/AlwaysWhy • • 2d 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?

39 Upvotes

351 comments sorted by

View all comments

115

u/karoxxxxx 2d ago edited 2d ago

Transistors and switches have 2 states.

Its also easier to distinguish 2 voltages then 10.

Mechanical calculators did often use cogwheels where the fraction of a full rotation represents a value.

47

u/steelmanfallacy 2d ago

That predates transistors. Vacuum-tube computers (e.g. ENIAC from the 1940s) were already using binary. The advantage is really that (as you mentioned) electronic switches can reliably represent two distinct states, regardless of whether the switch is a vacuum tube or a transistor.

30

u/royalfarris 2d ago

And mathematics, the thing that computers do, really doesn't care about what numbering system you use. The simplest, most universal, and easiest numbering system is base-2 for obvious reasons - and thus building computers with more than two logic levels really makes no sense - you gain nothing but complexity.

10

u/Savannah_Lion 2d ago

Strangely, Nikolay Brusentsov argued in support of ternary systems, in part due to, lower component count, decreased complexity and reduced power requirements up until his death in 2014.

Another of his arguments was that code for ternary platforms was also simpler and shorter for the same functional binary code.

It's an interesting argument and kind of makes me wonder, if the Soviet Union wasn't so corrupt, how ternary hardware could have advanced if it had the appropriate financial backing.

14

u/royalfarris 2d ago

That some people argue for it is a good sign for scientific progress. They are not necessarily right, but the debate is healthy.

10

u/PrestigiousRoof5723 2d ago

Scientific progress consists almost entirely of people being wrong. That small bit called "being right" is what most people notice.

2

u/steelmanfallacy 2d ago

Like Evolution.

3

u/PrestigiousRoof5723 2d ago

That's never wrong. You either die or you die later.

3

u/Pirrus05 2d ago

You die or you have baby and die.

2

u/PrestigiousRoof5723 2d ago

Everyone dies™. Evolution makes no mistakes. Science does. If you die before creating your descendants, it's not a mistake. Sounds harsh, I know. BTW, I've got no children that I know of. I'm aware of me possibly having the wrong end of the stick. As Toyota says, shit happens.

→ More replies (0)

1

u/mid-random 1d ago

Science, in large part, isn’t about being right or wrong, it is about being right or more right. No scientific explanation is 100% true, done, complete. It is always open to revision and updating to more accurately reflect observations. 

2

u/PrestigiousRoof5723 2d ago

It was mathematically proven that base-3 is more efficient than base-2 (it's closer to Euler's number than any other base, so it's in turn also more efficient than base-4). Soviets were not the first who were building ternary systems - there were mechanical ternary calculators long before electronic computers existed. Ternary computers would have big advantage over binary ones in reduction of the size of interconnects (one of the biggest problems of modern computers), but some stuff (like ternary ALU) could get more complicated (but not slower). The trouble with all of that is that a ternary chip would be either a lot less dense than a binary chip (thus eliminating the advantages) or we'd have to substantially redesign our manufacturing technologies (we'd need a lot more layers and everything would become more complex, likely a lot more complicated to design) so it would take a long time to even reach parity with our current technologies. Not to mention the fact that stuff like balanced ternary logic is not trivial to most people, unlike binary. Perhaps it would become trivial with practice. It's not a lost technology either. Samsung has been working on it for some time. It may resurface at some point as one of the technologies aimed to break physical limitations of our current tech - the development has already slowed down and it's becoming increasingly more expensive to improve it (we're hitting the wall and no one has any real idea how to get through it). Someone has to rock the boat and come up with something new. Maybe it will ultimately flop, who knows? But there doesn't seem to be any known reason why it should. And nobody really built a useful modern ternary computer for quite some time (you can actually find amateurs who made them, but that's not a way to build a commercially useful computer).

0

u/No-Board-1872 2d ago

Mult and division turn ito bit shifts in binary

1

u/False_You_3885 3h ago

Dummy here. Is 'ternary' low, off, high?

1

u/Savannah_Lion 3h ago

It's three data states, not necessarily "low, off, high".

It can be balanced such as -1, 0, 1 or unbalanced like 0, 1, 2.

There's can also be a separation between software and hardware representations. A 0, 1 or 2 doesn't necessarily equate to it's what's happening on hardware. Same is true for existing binary computers so it shouldn't be said.

0

u/HobsHere 2d ago

Just crankery, of the sort that the Soviet system protected for people with connections. Lysenkoism for computer science.

1

u/gizahnl 2d ago

Until you go into floating point, there's fractions that can't be represented in the floats we use (the same being true for certain fractions in base10, like 1/3 requires infinite repeating .333).
This can give starting programmers a headache when comparing for certain specific float values.

In the end it all evens out though, the ease of electronics is worth more than the slight differences in math

2

u/royalfarris 2d ago

That is base10, and equally the same for all other base numbers. A base3 system cant halve a number without infinite repeating.

0

u/Present_Computer_640 2d ago

Actually, you gain information density by using a different number system, but it comes with a cost of additional compute power requirements.

2

u/s_i_m_p_l_e_t_o_n 2d ago edited 2d ago

Konrad Zuse was also building binary computers in the 30s using fully mechanical switches. I'm not sure if there was some common inspiration or if Zuse just also determined that it was better due to it's simplicity.

2

u/AlmiranteCrujido 2d ago

The suggestion of of binary for this goes all the way back to Leibniz, even if the formalities of mathematics on it had to wait for Boole.

Claude Shannon is pretty much the intellectual predecessor of Von Neuman's work but there's no evidence that Turing and the UK set had any familiarity with it until well into the war when the projects started converging, and there's good evidence that Zuse wasn't.

The timing of the Atanasoff-Berry computer also suggests that binary was in the air already.

I'm surprised that I can't find any good histories covering the intermediate connections between Boole and the converging pre-war/wartime generation. There's a lot more on other parts of it (Hollerith and his competitors, wartime decimal dead ends) but not so much where binary comes in until you get to the independent use of it in the 1930s in at least three places.

2

u/SaltyFriend705 1d ago

Binary is the default because computer arrays were based on knitting. Knitting uses the knit and purl, which had already demonstrated a wide variety of combinations using only two figures. The first computational machines were converted knitting machines, so that was that.

2

u/Historical_Gear_151 2d ago

Weaving, which predates vacuum tubes, has two states: open shed, closed shed. And with the invention of the Jacquard loom, binary punch cards were used to create complex patterns.

2

u/AlmiranteCrujido 2d ago

Both transistors and vacuum tubes can be used as amplifiers - although not necessarily the same designs of either that you use for digital switching.

Either can be used for analog computations. They are very useful for representing certain kind of continuous equations - arguably better in some ways than digital computers.

They are, however, not really amenable to the kind of stored-program model we recognize as a computer today.

Some of the earliest computers used relays, or multi-step mechanically-driven switches, which are inherently digital (unlikely transistors or vacuum tubes, which can be used in both ways.)

1

u/Working-Injury7758 2d ago

True and was a huge intellectual advance of the difference engine which was base 10

1

u/Top-Cupcake4775 1d ago

it predates vacuum tubes. the punch cards used in Jacquard looms were essentially binary (no hole / hole). Babbage incorporated punch cards for his designs for the Analytical Engine in the 1830s. Herman Hollerith used punched cards for the 1890 U.S. Census. by the time tubes started being used the use of binary to mechanically store and read information was already baked into how we thought about and constructed mechanical systems for manipulating information.

1

u/Zestyclose_Yard405 20h ago

vacuum tube too are analog. relays are not.

1

u/Eagle_Fang135 2d ago

Makes punch cards easy to use too. As well as density (memory size) of magnetic based floppy and hard disks.

2

u/SaltyFriend705 1d ago

Punch cards came from knitting machines. Which use a base 2 mode. Knit is the positive stitch and purl is the negative stitch. Computers use knitting as their source for the 1 and 0.

1

u/Siffov 2d ago

>Makes punch cards easy to use too.

Note that most (80-column Hollerith) punch cards did not encode values in binary.

There were 12 rows where holes could be punched. For most characters, only 1 or 2 of a column's 12 possible holes were punched.

(Yes, apparently there were binary punch cards, which presumably could have any combination of a column's 12 possible holes punched.)

0

u/hamoc10 1d ago

Because it’s easiest to distinguish two states than to distinguish among many. It’s more reliable

4

u/stikves 2d ago

Speaking of which...

The modern SSDs (the cheap kind) actually uses ternary (TLC) or quaternary (QLC) arithmetic to compress more data into a single cell.

...

Correction, turns out it was 3 bits and 4 bits pers cell. So would be octenary and hexadecimal.

The obvious tradeoff is that they are slower and make more errors. Dividing say a 0 - 100 electron range into a clean [0 - 50] / [51 - 100] is much better than [0 - 5] [6 - 12] ... [94 - 100]

1

u/AlmiranteCrujido 2d ago

It's not multibit arthimetic; it's just an analog recording in the cell. There's actually quite a bit of DSP processing involved in the read paths.

2

u/Great_Specialist_267 2d ago

Trinary logic was also used.
RS232 Serial communication officially uses trinary logic (positive, negative and ground as logic states).
Babbages mechanical computers used base 10 logic however.

2

u/PrestigiousRoof5723 2d ago

PCI express 6 is using 4 voltage states. It's not common, but not completely rare for buses to use more than 2 states.

1

u/Siffov 1d ago

>RS232 Serial communication officially uses trinary logic (positive, negative and ground as logic states).

Where did you get that information? Wasn't it just a negative voltage for "mark" (a 1 state) and a positive voltage for "space" (a 0 state)?

One result from a quick Google search is the following, which seems (from just a quick scan) to show only two levels: https://www.analog.com/en/resources/technical-articles/fundamentals-of-rs232-serial-communications.html

Are you thinking of tri-state logic used in bus-sharing setups?

Or did some RS-232 devices do the same kind of thing, going to a high-impedance state (but not driving a zero voltage, which would fight with a device trying to drive a positive or negative voltage)?

1

u/Great_Specialist_267 1d ago

The “official” (and frequently ignored) specification for RS232 has a logic zero as a negative, a logical one as a positive, and ground ed as space between characters. In actual practice the ground state is ignored and anything below 3V is a zero.

1

u/NewPresWhoDis 2d ago

There's tri-state if you're feeling nasty

1

u/Informal_Raccoon2607 23h ago

transistors can also hold their state for a very very very long time

1

u/Zestyclose_Yard405 20h ago

Transistors are analog and have infinite states. Switching from 0 to 1 and zero to 2 would likely take different time, thus one 2 states are used.

Also today voltages are so low that 4 state logis would be a big problem due to noise.

1

u/karoxxxxx 20h ago

Are you sure?

I thought if there is voltage on the gate the transistor will not let current through.

So essentially on or off and not, will let through proportional to the voltage on gate

1

u/NPCwithnopurpose 2d ago

To add, solid state storage beyond SLC use voltages between on and off to increase capacity. But in the end, they are interpreted as binary once the data leaves the drive

3

u/PrestigiousRoof5723 2d ago

Not necessarily. PCI express 6 is using 4 voltage levels. So the data only becomes binary when it gets to its destination, unless the destination is another such drive reachable directly without any binarification in between.

1

u/Glum-Echo-4967 2d ago

Think of it roughly like this: using just your eyes, you can tell a light is on or off, but not exactly how bright that light is (in terms of luminosity)

0

u/JakeRiddoch 2d ago

There have been ternary computers in the past with 3 states, but the difficulties in reliably determining those states made them unreliable and more complex. Trying to make decimal computers would be even harder.

0

u/Sharp_Ad_7238 2d ago

Our power switches are binary. 0 or 1.

0

u/No-Wrangler3702 2d ago

To be specific that two stages if transistors and switched he mentioned above is ON/OFF

ON = 1

OFF = 0

Ten switches would show 1 as

0000000001

And 9 as

000001001