Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Why Binary?

  • 10-11-2006 5:31pm
    #1
    Registered Users, Registered Users 2 Posts: 6,566 ✭✭✭


    Dunno if this in is the correct forum, but got an assignment in college, and one of the questions doesn't seem to make sence to me

    "Explain why binary code is used in computers"

    Why? :confused:

    cant see what there looking for here tbh, why is it used? because thats all computers understand :rolleyes:

    anyone know what a suitable explanation would be?


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Electrical impulses are only on and off?

    God help us when we have to start learning the number system for quantum computing...


  • Registered Users, Registered Users 2 Posts: 6,566 ✭✭✭GrumPy


    Electrical impulses are only on and off?
    That what I first thought, but it's not really an explanation. It's a silly question anyway.

    Thanks.


  • Registered Users, Registered Users 2 Posts: 37,485 ✭✭✭✭Khannie


    It's because it's easiest and cheapest to make a device that has only two states (on and off).

    If you try making an electrical device at a small scale that has 3 or 4 distinct states and your cost increases dramatically. (for four states, the cost would increase more than the cost of two binary states (which would cover four states)).

    Short answer: Cost. :)


  • Registered Users, Registered Users 2 Posts: 32,136 ✭✭✭✭is_that_so


    Especially at the time when the original machines were being built. As with all assignments a bit of waffle does not go amiss.

    PS: Google is your friend ;)


  • Registered Users, Registered Users 2 Posts: 1,287 ✭✭✭joe_chicken


    BASIC:
    computer processors are based on transistors...

    transistors can either be in an on or off state depending on an electrical signal

    This means the CPU does calculations in base 2..

    You could make a processor that has multiple states (i.e. could be base 10) with some kind of fangled transistor making process...

    but it's easier to make the chip base 2 and then convert that to base 10 in software

    Is that ok?


    /edit Damn, beaten to it...


  • Advertisement
  • Closed Accounts Posts: 164 ✭✭Just My View


    Erm. There were no transistors when computers started.

    Banks of switches were originally used to load instructions into early computers and they were either on or off. Voltage or lack of voltage on a magentic coil was the way information was stored. Hence binary. Octal was simply a group of three binary sets and hex a group of four binary sets. When you write down a long binary string its real simple to convert from one base to the other by inserting commas every 3 or 4 bits as required and treating each set of bits as a single number. You group them right to left not left to right.

    eg 1001110 to octal (1,001,110)becomes octal 116
    or 1001110 to hex (100,1110) becomes hex 8e


  • Closed Accounts Posts: 17,163 ✭✭✭✭Boston


    Electrical impulses are only on and off?

    God help us when we have to start learning the number system for quantum computing...

    Tell me you don't believe that to be true!


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 94,272 Mod ✭✭✭✭Capt'n Midnight


    The Russians actually made a mainframe in trinary :eek:
    will have a root around for the reference in a book.

    as has been suggested it reduces component count and complexity and means you can use looser tolerances in manufacutring. Compare Babbage's difference engine with Konrad Zuse's relay built system. one used dials that could stop in 10 differnet places, relays open/closed.

    Binary maths is much easier to do in hardware than decimal. In binary addition / subtraction is simply a matter of comparing bits, the sum is 1 if both bits are different (XOR) and the carry is only 1 if both input bits are 1 (AND) and by using a lot more hardware you can use the inputs from every single bit to generate the final carry bit. Any two binary numbers can be added in 4 steps with a carry look ahead adder.
    [php]
    a + b = carry , sum
    0 + 0 = 0 , 0
    0 + 1 = 0 , 1
    1 + 0 = 0 , 1
    1 + 1 = 1 , 0
    [/php]Multiplication is just shifting one number to the left and adding it to the running total if the other number has a 1 at that bit. You could speed up here by using a separate adder for each bit and then combine them - or by shifting by more than one bit at a time. Two 32 bit numbers could be multiplied by using 32 carry look ahead adders, then 16, then 8,4,3,1 etc.. so taking 6 processing steps, and if you had 63 banks of adders 64,32,16,8,4,2,1 you could use have new numbers being worked on before the first was finished.

    So you could multiply two 32 bit numbers in 24 steps.

    32 bits is 10 digits. To multiply two 10 digit numbers manually you have to multiply each digit by each other digit (100 steps - not counting all the add and carries) and then add all the partial products together , probably ten 11 digit numbers, ( depends on how many zeros ) and EVERY operation between two digits is as complex as adding a pair of four bit numbers together.

    Oh yeah if you clock binary circuits on both rising and falling edges you are down to 12 clock cycles for multiply.


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 94,272 Mod ✭✭✭✭Capt'n Midnight


    Voltage or lack of voltage on a magentic coil was the way information was stored.
    Before that they had truly bizzare stuff, the strangest probably being the mercury delay line. You send "pings" into a tube filled with mercury using a "buzzer". Just like Sonar looking for a submarine. At the far end of the tube a "microphone" picked up the ping later on (speed of sound in mercury and all that) and fed it back to the buzzer. If you can imagine being in a big cave and saying something three seconds long. And then a microphone feeds the echo into a amplifier so those words keep repeating every three seconds forever. Mad as a bag of ferrets. But you could keep up to 1Kb of information litterly bouncing around in each delay line. Of course just like modern harddrives you have to wait for the data to come around again.


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 94,272 Mod ✭✭✭✭Capt'n Midnight


    from this book http://www.amazon.com/Electronic-Brains-Mike-Hally/dp/1862076634

    Page 155
    One of the most unusual of Russia's 1950's computers was the SETUN, an astonishing design with no Western counterpart. It used ternary arithmetic, which meant that instead of the 1s and 0s of binary it used 1,0 and -1. Although valves were the norm and now making way for transistors, the SETUN used ferrite cores the same devices that Boris Malinovsky had looked at some years earlier. Again this started as an alternative to using fragile, powerhungry and unreliable valves, and the original intention was to use binary arithmetic just as every other computer did. But in the course of its development the SETUN designer Nikolai Brunsentsov realized that binary arithmetic was wasteful and that magnetic cores were better suited to the three states required by ternary logic. And ternary logic, he believe, was better suited to programming.
    ...
    Remarkably for the period, cparticularly considering the novelty of the design, it took only 10 days of adjustment to become fully operational. It proved from the start to have low power consumption, and it was reliable and resonably cheap to build and sell. About 50 SETUNs were manufactured and used widely, mainly in universities.
    ...
    it is said taht when the first one was taken out of service in 1975 it had worked 17 years without a single malfunction. Sadly it was then destroyed, as were nearly all the others, though Bruenstov managed to save a SETUN-70 by secreting it away in the attic of one of the university buildings.


    see also http://hitechravlik.blogspot.com/2006_08_01_hitechravlik_archive.html
    Simplicity, economy and elegance of computer architecture are the direct and practically very important consequence of the ternarity, more exactly – of representation of data and instructions by symmetrical (balanced) code, i.e. by code with digits 0, +1, -1. In opposite to binary code there is no difference between "signed" and "unsigned" number. As a result the amount of conditional instructions is decrease twice and it is possible to use them more easily; the arithmetic operations allow free variation of the length of operands and may be executed with different lengths; the ideal rounding is achieved simply by truncation, i.e. the truncation coincides with the rounding and there is the best approximation the rounding number by rounded.


  • Advertisement
  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 94,272 Mod ✭✭✭✭Capt'n Midnight


    trivial but since no one else mentioned it ENIAC was decimal

    http://en.wikipedia.org/wiki/ENIAC
    Physically, ENIAC was massive compared to modern PC standards. It contained 17,468 vacuum tubes, 7,200 crystal diodes, 1,500 relays, 70,000 resistors, 10,000 capacitors and around 5 million hand-soldered joints. It weighed 30 short tons (27 t), was roughly 8 feet (2.4 m) by 3 feet (0.9 m) by 100 feet (30 m), took up 1800 square feet (167 m²), and consumed 150 kW of power.
    ...
    The reference by Rojas and Hashagen gives more details about the times for operations, which differ somewhat from those above. The basic machine cycle was 200 microseconds (20 cycles of the 100 kHz clock in the cycling unit), or 5,000 cycles per second for operations on the 10-digit numbers. In one of these cycles, ENIAC could write a number to a register, read a number from a register, or add/subtract two numbers. A multiplication of a 10-digit number by a d-digit number (for d up to 10) took d+4 cycles, so a 10- by 10-digit multiplication took 14 cycles, or 2800 microseconds—a rate of 357 per second. If one of the numbers had fewer than 10 digits, the operation was faster. Division and square roots took 13(d+1) cycles, where d is the number of digits in the result (quotient or square root). So a division or square root took up to 143 cycles, or 28,600 microseconds—a rate of 35 per second. If the result had fewer than ten digits, it was obtained faster.
    ...
    "We had a tube fail about every two days and we could locate the problem within 15 minutes."

    In 1954, the longest continuous period of operation without a failure was 116 hours (close to five days). This failure rate was remarkably low, and stands as a tribute to the precise engineering of ENIAC.


  • Registered Users, Registered Users 2 Posts: 1,287 ✭✭✭joe_chicken


    Erm. There were no transistors when computers started.

    So?....

    I could have sworn the question was:
    "Explain why binary code IS used in computers"
    and not
    "Explain why binary code WAS used in computers"


    (...unless you've goy many vacuum tube computers where you are, I think my answer wasn't all that bad... o yeah, and if you're gonna get that anal about it erm )


  • Registered Users, Registered Users 2 Posts: 8,067 ✭✭✭L31mr0d


    Khannie wrote:
    It's because it's easiest and cheapest to make a device that has only two states (on and off).

    If you try making an electrical device at a small scale that has 3 or 4 distinct states and your cost increases dramatically. (for four states, the cost would increase more than the cost of two binary states (which would cover four states)).

    Short answer: Cost. :)

    Exactamundo. The defacto answer to any question in electronics as to "WHY" we do something is nearly always "cost", whenever i'd be woken in up in class ;) when the lecturer would be discussing computer systems/arch./engineering my reflex answer would be "divide it by 8" or "cost", seemed to work most times :D

    ergo, it is a lot cheaper to implement a binary system in hardware than to implement octal, decimal or hexadecimal. Example, the hardware needed for binary multiplication/division using 2's compliment is maybe 1/10th as complicated as that for decimal.

    The next big question is, if only you and dead people can read hex? How many people is that? ;)


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    The first ever computer used paper tape, which could only produce a hole (1) or blank (0).

    The other information above on transistors and complexity is also true.

    As for learning Quantums numbering system thats easy. Just write anything on the page and then explain to the teacher that because they observed it that it caused the answer to collapse to what was written. ;)


  • Closed Accounts Posts: 1,956 ✭✭✭layke


    Erm. There were no transistors when computers started.

    Banks of switches were originally used to load instructions into early computers and they were either on or off. Voltage or lack of voltage on a magentic coil was the way information was stored. Hence binary. Octal was simply a group of three binary sets and hex a group of four binary sets. When you write down a long binary string its real simple to convert from one base to the other by inserting commas every 3 or 4 bits as required and treating each set of bits as a single number. You group them right to left not left to right.

    eg 1001110 to octal (1,001,110)becomes octal 116
    or 1001110 to hex (100,1110) becomes hex 8e

    Yup, but it's the same principal.

    Transistor = open or closed, same as a valve which is just slower or the switch system your talking about. e.g 0=open 1=closed.
    It's all still relying on binary.

    I think the question has already been answered in this thread.


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    LiouVille wrote:
    Tell me you don't believe that to be true!
    I don't believe that to be true.


Advertisement