Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-31-2010, 05:07 PM   #1
BSOD
 
Join Date: Dec 2010
Posts: 582
Default Binary

Please understand I'm young and here to learn.

Can someone please explain Binary as simple as they can please.

I have looked at some explanations and I go as far as understanding it is a code with the digits 0 and 1 used in keyboards but then as I go on I get lost.

Please help
__________________

clacker is offline   Reply With Quote
Old 12-31-2010, 05:55 PM   #2
Site Team
 
celegorm's Avatar
 
Join Date: Sep 2006
Posts: 10,713
Send a message via AIM to celegorm
Default Re: Binary

Binary is a very large topic so you're going to need to be a little more specific on what you want to learn. We could spend an entire thread just on Binary math, or even things like how a network signal works or even how binary is used to send data from a CPU to RAM and back.
__________________

__________________
"as a fanboy i refuse to admit it and will pull countless things out of my butt to disprove it"

Team Thelegorm! Total Kills: 21 (i iz in uor profile, editsing your sigz)
celegorm is offline   Reply With Quote
Old 12-31-2010, 06:35 PM   #3
BSOD
 
Join Date: Dec 2010
Posts: 582
Default Re: Binary

Quote:
Originally Posted by celegorm View Post
Binary is a very large topic so you're going to need to be a little more specific on what you want to learn. We could spend an entire thread just on Binary math, or even things like how a network signal works or even how binary is used to send data from a CPU to RAM and back.

How is it involved in computers and how you work out the code?
clacker is offline   Reply With Quote
Old 12-31-2010, 09:52 PM   #4
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: Binary

Perhaps the simplest way of thinking about it is as a number base. Normally we work in base 10, using 10 different digits (0-9). In binary we only use two digits, 0 and 1.

Think of numbers as columns of digits. In base 10, say we have the number 159, that's made of 3 columns. The first number (the right most column) will be 9*10^0, the second 5*10^1, the third 1*10^2. To get the resulting number we add those values together, which gives us (unsurprisingly in this case) 159! (9 + 50 + 100.)

We can apply this same logic to base 2, with a number such as:

10110.

So, from the right we have 0*2^0 + 1*2^1 + 1*2^2 + 0*2^3 + 1*2^4. This gives us 0 + 2 + 4 + 0 + 16, which gives us 22. So 10110 in binary is 22.

Using the above system you can represent any (whole positive) number in binary. (There's methods of representing floating point numbers and negative numbers as well, but I won't confuse you with those for now!)

How is it involved in computers? Well it's useful because each binary digit represents either on or off, which corresponds very neatly to how any electronic circuit works, by means of switches. In computers these switches are called transistors, there's millions of them that make up a CPU and they turn on and off millions of times a second to perform all the calculations you require. So at the core of a PC everything gets translated into binary 1s and 0s, this in turn gets translated to analogue voltage levels (5V and 0V for instance) which turn the transistors on and off, which perform calculations.

There is of course a lot more to it than that, but that's the basics of how it all links together.
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 01-01-2011, 06:16 PM   #5
BSOD
 
Join Date: Dec 2010
Posts: 582
Default Re: Binary

Quote:
Originally Posted by berry120 View Post
Perhaps the simplest way of thinking about it is as a number base. Normally we work in base 10, using 10 different digits (0-9). In binary we only use two digits, 0 and 1.

Think of numbers as columns of digits. In base 10, say we have the number 159, that's made of 3 columns. The first number (the right most column) will be 9*10^0, the second 5*10^1, the third 1*10^2. To get the resulting number we add those values together, which gives us (unsurprisingly in this case) 159! (9 + 50 + 100.)

We can apply this same logic to base 2, with a number such as:

10110.

So, from the right we have 0*2^0 + 1*2^1 + 1*2^2 + 0*2^3 + 1*2^4. This gives us 0 + 2 + 4 + 0 + 16, which gives us 22. So 10110 in binary is 22.

Using the above system you can represent any (whole positive) number in binary. (There's methods of representing floating point numbers and negative numbers as well, but I won't confuse you with those for now!)

How is it involved in computers? Well it's useful because each binary digit represents either on or off, which corresponds very neatly to how any electronic circuit works, by means of switches. In computers these switches are called transistors, there's millions of them that make up a CPU and they turn on and off millions of times a second to perform all the calculations you require. So at the core of a PC everything gets translated into binary 1s and 0s, this in turn gets translated to analogue voltage levels (5V and 0V for instance) which turn the transistors on and off, which perform calculations.

There is of course a lot more to it than that, but that's the basics of how it all links together.

That helped thanks I understand it a bit more now.

Still having trouble with that code though.
clacker is offline   Reply With Quote
Old 01-01-2011, 06:17 PM   #6
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: Binary

What parts are you having trouble with? Try and explain what you know, it often helps things sink in that way.
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 01-01-2011, 06:54 PM   #7
BSOD
 
Join Date: Dec 2010
Posts: 582
Default Re: Binary

*2^0 + 1*2^1 + 1*2^2 + 0*2^3 + 1*2^4. This part I dont understand how that turns into 0 + 2 + 4 + 0 + 16.

Sorry if i'm being a bit of a idiot.
clacker is offline   Reply With Quote
Old 01-01-2011, 07:05 PM   #8
Site Team
 
berry120's Avatar
 
Join Date: Jul 2009
Location: England, UK
Posts: 3,425
Default Re: Binary

Take each individual part of that sum (each bit that's being added) in the first and just work it out. The bit on the left is 0, then 2, then 4, then 0, then 16. It's just showing a simplified step before we end up at the final answer.
__________________
Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 01-02-2011, 01:24 PM   #9
Fully Optimized
 
~Darkseeker~'s Avatar
 
Join Date: Jan 2010
Location: Welwyn Garden City, United Kingdom
Posts: 2,494
Default Re: Binary

the basics of binary as i understand them:

-Binary works in powers of 2 (e.g. 1, 2, 4, 8, 16 and so on)

-a binary 1 is a 'bit' and a 0 represents when a power is not present.
-Binary works usually from right to left in ascending order, but it is read from left to right.

a quick example.

here is a binary number : 111000

you can see it has 6 digits, so it will be in 6 spaces on a numbered line. the first 1 has to go 6 numbers in from the right, like this:


128 64 32 16 8 4 2 1

1

as you can see, this represents 32, so we currently have a total of 32 after the first 1. The rest of the binary figure can be put into the spaces to the right of the number.

182 64 32 16 8 4 2 1

1 1 1 0 0 0

so, where we have 1's, we have numbers, and where there are 0's, there is nothing. so right now, we have 32, 16 and 8.

32+16+8 = 56.

therefore, 111000 = 56.


hope this helps and isnt just confusing, its a wide topic with many uses, and can be hard to grasp first time round.

just recognise that binary (powers of two, dotted decimal) is different entirely to hexadecimal (powers of 16, hexadecimal)

__________________
EVGA SLI Micro Z68 // Intel i5-2500k @ 4.4GHz // 8GB Corsair Vengeance 1866MHz // Overclocked ASUS GTX 660 Ti // Corsair Carbide SPEC-03 // Kingston Hyper-X 120GB // 2TB WD Green + 500GB WD Black
#JC4PM
~Darkseeker~ is offline   Reply With Quote
Old 01-02-2011, 05:15 PM   #10
BSOD
 
Join Date: Dec 2010
Posts: 582
Default Re: Binary

Quote:
Originally Posted by ~Darkseeker~ View Post
the basics of binary as i understand them:

-Binary works in powers of 2 (e.g. 1, 2, 4, 8, 16 and so on)

-a binary 1 is a 'bit' and a 0 represents when a power is not present.
-Binary works usually from right to left in ascending order, but it is read from left to right.



a quick example.

here is a binary number : 111000

you can see it has 6 digits, so it will be in 6 spaces on a numbered line. the first 1 has to go 6 numbers in from the right, like this:


128 64 32 16 8 4 2 1

1

as you can see, this represents 32, so we currently have a total of 32 after the first 1. The rest of the binary figure can be put into the spaces to the right of the number.

182 64 32 16 8 4 2 1

1 1 1 0 0 0

so, where we have 1's, we have numbers, and where there are 0's, there is nothing. so right now, we have 32, 16 and 8.

32+16+8 = 56.

therefore, 111000 = 56.


hope this helps and isnt just confusing, its a wide topic with many uses, and can be hard to grasp first time round.

just recognise that binary (powers of two, dotted decimal) is different entirely to hexadecimal (powers of 16, hexadecimal)

That did help a bit but I'm sure I will understand it with a bit more studying.
__________________

clacker is offline   Reply With Quote
Reply

« Python | JavaFX 2.0 »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 07:54 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0