Computing.Net > Forums > Programming > Someone explain Binary to me.

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Someone explain Binary to me.

Reply to Message Icon

Name: dingchavez
Date: October 20, 2004 at 09:02:16 Pacific
OS: Win XP
CPU/Ram: 2600+
Comment:

How does it work, why do you need it?



Sponsored Link
Ads by Google

Response Number 1
Name: zoddy
Date: October 20, 2004 at 10:03:13 Pacific
Reply:

binary are the 1's and 0's of computers.

binary looks like 001001010010110001.

A+ Certified


0

Response Number 2
Name: petteyg359
Date: October 20, 2004 at 13:30:02 Pacific
Reply:

When you count from 0 to 9, you are counting in "base 10" (decimal), where there are ten numbers, 0-1-2-3-4-5-6-7-8-9. In binary or "base 2", there are only two numbers, 0 and 1.

Counting:
Decimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111

Usually binary is done in groups of four, each group is called a "word". To translate a number into binary:

8 4 2 1

The above would be place markers. The highest number that can fit in the first binary word is 15. Notice that the smallest decimal number is on the far right, above. To convert a number, first subtract the largest of the binary places that you can.

If you wanted to convert 9 into binary, then 8 is the largest number you can subtract from it, so you have

8 4 2 1
1

You cannot subtract 4 or 2 after subtracting 8 from 9, as only 1 is left, so put zeroes there.

8 4 2 1
1 0 0

You can subtract 1, and then you are done, so decimal 9 is 1001 binary

8 4 2 1
1 0 0 1

MSI K7N2 Delta-ILSR
AMD Athlon 2700+
1024MB Dual Channel DDR400 PQI Turbo
128MB Radeon 9200SE


0

Response Number 3
Name: Jake2
Date: October 20, 2004 at 15:22:35 Pacific
Reply:

To answer the "why" of binary, modern computers know only on and off, high and low voltage. These two states are represented mathematically as 1 and 0.

I disagree with Gordon about the definition of "word". I always thought 4 bits formed a "nibble" and four nibbles or 16 bits formed a "word".

The key to understanding any base is knowing what it means to write numbers the way we do. In base 10, 123 = 3*10^0 + 2*10^1 + 1*10^2 = 3 + 20 + 100. Binary works the same way. 1001 = 1*2^0 + 0*2^1 + 0*2^2 + 1*2^3 = 1 + 0 + 0 + 8 = 9.

I always think of the conversion base "x" algorithm as "Divide the number by x and the remainder will be the last digit of the base x representation. Divide the whole part of the answer from the previous division by x and the remainder is the second-to-last digit, and so on...". Gordon's method is faster for binary.


0

Response Number 4
Name: BlueRaja
Date: October 20, 2004 at 16:44:04 Pacific
Reply:

The size of a word differs depending on the processor.
Considering that most home-processors nowadays are 32-bit/4-byte (although there will be a trend to go to 64 bit in the coming years - I'm using a 64-bit Athlon as I type), a word is usually considered to be 32 bits.
And, as Jake mentioned, half a byte (4-bit) is a nybble - the term is rarely used, except when using hexadecimal (base 16) numbers.

AKhalifman@hotmail.com


0

Response Number 5
Name: SN
Date: October 20, 2004 at 19:28:17 Pacific
Reply:

BlueRaja is right...The size of a word is defined by the architecture of the system. Technically, so is the size of a byte, but since it's been 8 bits on essentially every modern application it's pretty much a de facto definition.

I think the size of a word usually corresponds to how wide the memory bus is, but it doesn't have to.

-SN


0

Related Posts

See More



Response Number 6
Name: Jake2
Date: October 20, 2004 at 21:16:08 Pacific
Reply:

Thanks for clearing up the word thing. I thought it was an archtecture thing, but I googled it and saw all these places that said 16 bits.

Back on topic, negative numbers are represented in binary with the "two's complement" form so that subtraction is actually addition. Two's compliment numbers work by making the addition carry past the number of bits the computer stores for the number. For example, in 8-bit binary 1 - 1 = 0 would be 1 + 1111 1111 = 1 0000 0000, but the leading one gets dropped so the answer becomes 0.


0

Response Number 7
Name: Dr. Nick
Date: October 20, 2004 at 21:26:54 Pacific
Reply:

How Bits and Bytes Work

I always loved the term "nibble". Ever since I first played that QBasic game Nibbles I always hoped that I'd get to come up with a term like that someday. I can just see how it was thought up:

Engineer 1: Eight bits is a byte, but we use four bits to represent binary in hex. What can we call each of those?

Engineer 2: Well, they are half of a byte.

Engineer 1: So they are small bytes.

Engineer 2: And small bytes are nibbles... Hey!

Brilliant! :)


0

Response Number 8
Name: jubalsams
Date: October 21, 2004 at 21:28:29 Pacific
Reply:

A Word is 16 bits, 32 bits is called a DoubleWord, at least in assembler language. 64 bits is called a QuadWord.
The only time a confusion might arise would be when the machine does not use 8,16,32 or 64 bits as basic storage unit. Some old or intermal cpu's use 10, 12 or 15 bits for rom store. HP41C uses 56 bits for cpu store, 10 bits for rom store and 8 bits for ram store.
With a 10 bit rom store one has 1024 possible instructions for the cpu (not counting multiword instructions).


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Someone explain Binary to me.

Java question www.computing.net/answers/programming/java-question/15489.html

Shell Programming: Recycle_bin www.computing.net/answers/programming/shell-programming-recyclebin/1758.html

php code to email mysql query to me www.computing.net/answers/programming/php-code-to-email-mysql-query-to-me/10499.html