Is binary system the only choice for the computer?

  • #1
332
1

Main Question or Discussion Point

Hi

Using the binary system for computing is a natural choice because of its two states: 0 and 1. But is this possible to use base 10, which is used in everyday matters, instead of base 2?

Please remember that I'm neither a student of comp. science nor of science/math, in general. Thanks for your time and help.
 

Answers and Replies

  • #2
fss
1,179
0
Not in a practical sense. 0 and 1 are nice because it's easy to map those two values to a voltage (for example, 0 -> 0 V, 1 -> 5 V). In a base-10 system you'd need 10 levels of voltage, and you wouldn't really gain anything in the end since base-10 numbers can be expressed as base-2 quite simply.
 
  • #3
33,506
5,192
Another number system, base 16 (hexadecimal) is very commonly used, and another number system, base 8 (octal), was formerly used, but isn't used so much any more. If you break up a binary string into groups of four, each quartet of bits can represent a number in the range 0 through 15. The hex digits are 0, 1, 2, ..., 9, A, B, C, D, E, and F (0 through 15 in decimal). IOW, each group of four binary digits represents a single hex digit.

With the octal number system, each group of 3 binary digits represents a number in the range 0 through 7, and these are exactly the octal digits.

Both 8 and 16 are powers of 2, with 8 = 23 and 16 = 24. There aren't any such nice relationships between 2 and 10, so it's somewhat unfortunate that humans have 10 fingers and 10 toes. It would be nicer if we had 8 fingers and 8 toes.:smile:
 
  • #4
131
0
Back in the old days, there was also BCD (binary-coded decimal). It uses 4 bits for each digit like base 16 but ignores 10-15. An 8-bit byte would be 0 to 99. It made it easier to deal with data that needed to be displayed in base 10. The disadvantage is that you lose a lot of data space (0-99 instead of 0-255 in one byte). Some microcontrollers still have BCD instructions for add, subtract and the like.
 
  • #5
rcgldr
Homework Helper
8,682
520
A binary system makes sense for an electrical computer, since it's easier and faster to use a single voltage threshold to distinguish between 0 and 1, then group bits of data to form larger variables.

Some data transmission devices use complex encoding and decoding schemes that transmit the equivalent of multiple bits per transition.

In the case of a mechanical computer, such as some old calculating machines that resembled typewriters, then decimal works just as well since these include the usage of gears that can easily be designed to have 10 different states (positions).

As mentioned previously, the cpus used on a PC still include the ability add and subtract BCD (binary coded decimal). Mainframes such as the IBM 390 (decendant of the 360) have a set of instructions to perform math with BCD strings as well as an instuction to copy and format a BCD string into an text (EBCDIC) string.
 
Last edited:
  • #6
332
1
Thanks a lot, everyone. FSS, Mark, Caffentra, RCG. Sadly, I'm really dumb in science related field and it takes some time to get ideas settled inside my head. I seek you help.

Not in a practical sense . 0 and 1 are nice because it 's easy to map those two values to a voltage (for example, 0 -> 0 V , 1 - > 5 V ). In a base-10 system you ' d need 10 levels of voltage, and you wouldn ' t really gain anything in the end since base-10 numbers can be expressed as base-2 quite simply.
Especially in computer, things are either off or no, no intermediate states - that's what digital electronics is. So, a binary system's two states, 0 and 1, nicely maps onto two voltages such as 0v and 5v. If for base-10 system you would need 10 levels of voltages, then what is it? A diode could be either on or off, so what does it have to do with 10 different values of voltage. It will only get confused. The same applies to a transistor. To me, it seems binary is the only choice, as you can see.

Please guide me. Thanks.
 
  • #7
rcgldr
Homework Helper
8,682
520
On a side note, although BCD (binary coded decimal) is implemented using binary logic, for some business environments (like banking), it's preferred to keep all numbers in BCD format so that rounding is always based on the decimal system and numbers are always stored as decimal numbers, avoiding any issues related to round off or encoding issues related to conversion from binary floating point to decimal. This is why some mainframes and computer languages like Cobol continue to support BCD (called packed decimal in the case of Cobol).
 
Last edited:
  • #8
131
0
Especially in computer, things are either off or no, no intermediate states - that's what digital electronics is. So, a binary system's two states, 0 and 1, nicely maps onto two voltages such as 0v and 5v. If for base-10 system you would need 10 levels of voltages, then what is it? A diode could be either on or off, so what does it have to do with 10 different values of voltage. It will only get confused. The same applies to a transistor. To me, it seems binary is the only choice, as you can see.
Transistors and diodes are analog devices like other electronic devices. They have specific I-V curves, not just on/off. We define what 0 and 1 means (below or above a certain threshold). You could have another implementation using multiple values by defining voltage or current ranges like previously stated.
 
  • #9
chiro
Science Advisor
4,790
131
Hi

Using the binary system for computing is a natural choice because of its two states: 0 and 1. But is this possible to use base 10, which is used in everyday matters, instead of base 2?

Please remember that I'm neither a student of comp. science nor of science/math, in general. Thanks for your time and help.
If you want to represent numbers in any integer base all you need are integer divide and modulus operators.

On most computers, these can be done in fractions of fractions of a second. The general algorithm is to use the integer division and to store the mod of a result recursively until you have nothing left.

For a binary base, the division becomes a shift and the modulus becomes an AND operation and these are optimal obviously for base 2.
 
  • #10
4,239
1
As mentioned by rcgldr, in some hardware implementations such a mechanical adding machine a base ten encoding scheme is practical and useful. The use of binary is really inherited from the nature of transistors and what you can build with them.

Logic requires saturating states or compounded systemic error will cause a bit to change value after passing though a sufficient number of gates.

A good and simple example is an buffer using a 5 volt supply. If the input is 0 to 2.0 volts you might be guaranteed by specifications that the fully loaded output will be 0 to 0.5 volts. For a high input of 3.0 to 5.0 volts the output might be 4.5 to 5.0 volts. The state error in each case is decreased by a factor of 4 in this example.

As a real world example look up "CMOS inverter transfer function". The idea is the same, but you will be reading about an inverter that outputs a 1 for an input of 0 and visa versa.

You might imagine how much more silicon this might require if you wanted a 3 state buffer with three output states. At a guess it would take about 5 times as many transistors to pull this off. In comparison the information density has increased by only ln3/ln2.
 
Last edited:
  • #11
332
1
Once again, thanks everyone. Genuinely speaking didn't understand much of that but someday will do!

I was wondering that perhaps using base-10 system would lead to more complicated circuits. Is there any truth in my guess? Please let me know. Thanks.
 
  • #12
AlephZero
Science Advisor
Homework Helper
6,994
291
In the early days of electronic computing (up to about 1960) some machines were very muich geared to working in decimal (for example the IBM 1640) even though the decimal digits were stored as 4-bit binary numbers. Actually, the 1640 was way head of its time in some respects, for example its machine code instructions could handle arbitrary-precision decimal arithmetic automatically, though the time to execute a one-instruction program to multiply two 100-digit numbers was measured in minutes, not microseconds.

There were electronic components like the dekatron tube (= UK valve) that worked as a storage or counting device in base 10. In fact they could have been built to work in any reasonalbly small number base, the was nothing special about the number 10.

The original European mechanical calculators and the first programmable computer (Babbage's Analytical Engine) all worked in base 10. Most Eastern abacuses (abaci?) work in a combination of bases 5 and 2.
 
  • #13
chiro
Science Advisor
4,790
131
Once again, thanks everyone. Genuinely speaking didn't understand much of that but someday will do!

I was wondering that perhaps using base-10 system would lead to more complicated circuits. Is there any truth in my guess? Please let me know. Thanks.
If you use the architecture that is used in computers to use base 10, then all you will be doing is adding extra bits for each "digit". By doing this you will be wasting silicon since you will need 4 bits and these bits are not using their full potential (using 10 combinations instead of 16).

Its better to use division and the modulus function to work in any base. Like I said before its fast enough and it doesn't waste space.

Lets say you want to work in base 10 and your number is 999. To turn it into base 10 you do

(Note / means INTEGER division ie you toss away the decimal part)

976/10 = 97. 976 MOD 10 = 6
97/10 = 9. 97 MOD 10 = 7
9/10 = 0 9 MOD 10 = 9

Then to get number you go from bottom upwards with the MOD result to get the number. Now lets do it in binary

976/2 = 488 976 MOD 2 = 0
488/2 = 244 488 MOD 2 = 0
244/2 = 122 244 MOD 2 = 0
122/2 = 61 122 MOD 2 = 0
61/2 = 30 61 MOD 2 = 1
30/2 = 15 30 MOD 2 = 0
15/2 = 7 15 MOD 2 = 1
7/2 = 3 7 MOD 2 = 1
3/2 = 1 3 MOD 2 = 1
1/2 = 0 1 MOD 2 = 1

This gives 1111010000 in binary. You can convert it to base 10 by

0 x 2^0 + 0 x 2^1 + 0 x 2^2 + 0 x 2^3 + 1 x 2^4 + 0 x 2^5 + 1 x 2^6 + 1 x 2^7 + 1 x 2^8 + 1 x 2^9 = 976

Computers can do this very very quickly.
 
  • #14
33,506
5,192
Without some punctuation, the following is confusing.
chiro said:
(Note / means INTEGER division ie you toss away the decimal part)

976/10 = 97. 976 MOD 10 = 6
97/10 = 9. 97 MOD 10 = 7
9/10 = 0 9 MOD 10 = 9
I get it now, but it would have been clearer to say
976/10 = 97, and 976 mod 10 = 6, and so on.

Same here.
chiro said:
Then to get number you go from bottom upwards with the MOD result to get the number. Now lets do it in binary

976/2 = 488 976 MOD 2 = 0
488/2 = 244 488 MOD 2 = 0
244/2 = 122 244 MOD 2 = 0
122/2 = 61 122 MOD 2 = 0
61/2 = 30 61 MOD 2 = 1
30/2 = 15 30 MOD 2 = 0
15/2 = 7 15 MOD 2 = 1
7/2 = 3 7 MOD 2 = 1
3/2 = 1 3 MOD 2 = 1
1/2 = 0 1 MOD 2 = 1
 

Related Threads on Is binary system the only choice for the computer?

Replies
2
Views
7K
Replies
9
Views
12K
  • Last Post
Replies
2
Views
559
  • Last Post
2
Replies
28
Views
3K
Replies
1
Views
15K
  • Last Post
Replies
24
Views
4K
  • Last Post
Replies
1
Views
6K
  • Last Post
Replies
5
Views
2K
Replies
4
Views
3K
Top