Jump to content

Binary


noz92

Recommended Posts

What exactly is binary (I know it's a code that computers use to share and store data), but how does it work, what is it (as in is it electrical signals or something?), and what is the codes, and how does a computer know what 1's and 0's are?

Link to comment
Share on other sites

Mathematical: The standard system used is the decimal system which has ten letters {0,1,2,3,4,5,6,7,8,9}. Now, if you start to count you can count to 9. Then you run out of letters. Thus, you write the next integer as 10. Binary system only has two letters {0,1}. In the binary system you then count 0, 1, 10, 11, 100, 101, ... .In both systems the combination of letters is simply a representative of an integer and 6 decimal would equal 110 binary, for example.

 

Realization for computers: You could think of a lot of other representations than letters. {"Voltage on", "Voltage off"} is used in computers, afaik. So, the decimal 6 from above could be written as OnOnOff.

Link to comment
Share on other sites

the far right digit is the number of one's in the number

the second from the right is the number of two's in the digit

third from the right=4's

fifth=8's

and so on in base 2

 

i also think that there is a value to tell whether it is + or - but i will someone else tell you about that

 

so binary two is 10 because the "tens" digit represents how many two's there are in the value so...1 value of two + 0 value of ones = 2

 

and then since there are eight bits to a byte and byte can store a value up to something and the largest number that can be stored in memory is something because of the eight digits in bytes and the number of byte used to store things

 

that's all i have

 

interested to see the other answers to your questions though

Link to comment
Share on other sites

>> I also think that there is a value to tell whether it is + or - but i will someone else

>> tell you about that

 

I really should have said "natural numbers" instead of "integers" above to avoid that problem. Nevertheless:

 

Mathematically: What about "+" and "-" ? :D

 

Realization on computer: Discussing this in detail imho leads a bit too far for someone who doesn´t even know the binary system. However, for those who know the binary system and are interested in that:

 

For simplification consider you are limited to three digits ("On"=1, "Off"=0):

In this case the computer would store -1 as OnOnOn,

Adding one then -theoretically- would give OnOffOffOff,

As you only have three digits that´s OffOffOff

So -1 + 1 = 0

 

The additional On would be stored in the so-called carry-flag in the processor in case it´s needed (may it´s called overflow-flag, haven´t programmed assembler for almost ten years now).

Note that in above case OnOnOn could either be 7 or -1. It´s up to the programmer (or the compiler) to know what´s meant.

Link to comment
Share on other sites

What is being discussed so far is numbers in base 2.

However using binary ,i.e., the set {0,1}, a huge variety of codes can be developed. Some of the more popular ones you can find easily are BCD, grey code, XS3 code etc. These are all for encoding numbers.

You then have ASCII codes for characters.

AS situations demand you can come up with a code for practically anything, depending on what code you use, you will build your particular hardware to interpret it.

Link to comment
Share on other sites

each column is weighted, just like in Decimal, units, tens, hundreds etc...

in Binary it`s a little different, it`s weighted 1,2,4,8,16,32 and so on each weight being exactly 2 times the the number before it.

 

using only ones and zeros, to represtent a quantity from each weight(1) or Not a quantity (0) any number can be made up :)

 

think of the number 27 for example, what`s it made up of using 16.8.4.2 or 1

 

11011

 

that`s one 16 and one 8 and Zero 4`s one 2 and one 1. that all adds up to 27 :)

 

the reason it`s used in computers is beacause it`s really easy for a machine to represent, it`s either On or OFF, like a switch. and transistors make great switches :)

Link to comment
Share on other sites

Just to add, we use binary because we know how to make devices that have two stable states {0,1}. If on the other hand we could get basic components that had 3 stable states, it would at times make more sense to use base three.

Link to comment
Share on other sites

Call the "letters" "digits" if that´s more familiar for you. I should indeed have taken the time to look that word up before posting to avoid unnecessary confusion. But in the end the point is just that you have a finite set of symbols (ten for decimal, two for binary) that you name the infinite number of natural numbers with. What does the thing in parentheses mean?

Link to comment
Share on other sites

4 bit binary? hex is base 16. might help if i knew exactly what a bit equals i guess : P (isnt a bit just 8 digits or something like that?)

a "bit" is a single number, a 1 or a 0

a "Nibble" is 4 bits and used to represent a single Hex number

a "Byte" is 8 bits or 2 nibbles

 

then we move onto "Words" and "Long words" usualy 16 bits and 32 bits respectively.

Link to comment
Share on other sites

yeah, a bit = 1 or 0

no one uses nibbles anymore!

byte = 8 bits

kilobyte = thousand bytes

megabyte = million bytes

gigabyte = 1000 megabytes (you do the maths for bytes!)

terrabytes = 1000 gigabytes.

 

however, those are not precise values, they are standardised figures, for instances kilobyte is actuallly 1024 bytes and megabyte is 1,000,024 bytes (etc) - but the first lot is accepted by everyone - though if i hadnt have said this paragraph someone would have said that i was wrong!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.