Mail from ILUG-BOM list (Non-Digest Mode)
Sometime on Jun 23, Rajen Parekh assembled some asciibets to say:
> All this is quite technical. Still I am trying to understand it. Can you
> tell me what you mean by most significant bit?
Ok, ask a technical question, you get a technical answer. I will try and
explain this.
A binary number has only two digits - 0 and 1 - unlike your decimal system
which has 10 (0 - 9). All numbers must be represented using only these
two digits.
dec bin
0 0
1 1
2 10 (pronounced one-zero)
3 11
Notice that in decimal, when you move past 9 (the last digit), you add 1
to the digit to the left, and proceed from 0.
So, after 9 (== 09), you go to 10 (0->0+1=1, 9->0)
Similarly, when you go past 1 in binary, you add 1 to the digit to the
left, and proceed from 0
So, after 1 (== 01), you go to 10 (0->0+1=1, 1->0)
Now, the left most digit, is called the most significant digit, because
changing that digit, will make the most significant change to the number
as a whole.
ie: No: 357. If you change the 3, you are making a change worth
hundreds. If you change the 5, you are making a change worth tens, if you
change the 7, you make an insignificant change.
Hence, left most -> most significant, right most -> least significant.
We also number digits from the right. So the least sig dig is in position
0. Because its value is given by n*10^0
Similarly, in binary, the value is given by n*2^0, n*2^1, n*2^2...
depending on the position.
In an 8 bit byte, the most significant position is position 7.
1*2^7=128
Now, if you keep the most significant bit as 0, then all the other 7 bits
(0 - 6) can total up to only 127 (try it). Hence, your network is limited
to IP addresses having 1 to 127 in the first byte (0 is not allowed).
> Same question here and also below, what is the meaning of most significant
> bit? And how is related to assign IP addresses?
Your IP address is basically a 32 bit (4x8bit) binary number. We humans
of course would find it hard remembering a string of 32 ones and zeroes
(forget about remembering entire subnets), so the 32 bit number is broken
into 4 8 bit numbers and each is represented in decimal giving your common
dot notation.
DID YOU KNOW: That if you use the full 32 bit representation (in decimal)
you would still go to the same site? Try it. Take an IP address of a
site. Get its decimal equivalent, and go there. In fact, you could take
it as 32 bits, 24.8 bits, 16.16 bits, 16.8.8 bits etc. All works out to
the same.
> Sorry Philip, but what is ANDing and what is NANDing? I think due to my
> non-engineering background, I will be asking you such [silly?]
Ok, this is something we learnt in school (8th standard) so doesn't really
require a math background. I also did it in FYBSc Math. It has also been
posted earlier and you will find it in the archives, but while I'm at it,
here goes:
1. Negation / NOTting / Complement
NOT is a unary operation that works by inverting all bits of a number
Symbol (in C): ~
Don't confuse with ! which is a boolean negation, not a binary negation
Truth Table
A ~A
0 1
1 0
10 01
11 00
etc...
2. ORring / Non exclusive OR
Or is a binary operationx that returns 1 if either one of the bits orred
is 1.
Symbol: |
Don't confuse with || which is a boolean or.
A B A|B
0 0 0
0 1 1
1 0 1
1 1 1
00 01 01
10 01 11
01 01 01
etc...
3. AND
Binary operation. Returns true if BOTH operands are true (1)
Symbol: &
Don't confuse with &&
A B A&B
0 0 0
0 1 0
1 0 0
1 1 1
00 10 00
00 11 00
01 10 00
11 01 01
etc....
4. XOR
Exclusive or. Unlike OR, returns true when only ONE of the operands is
true.
Symbol: ^
Don't confuse with: Up arrow key, inverted v, a hat.
A B A^B
0 0 0
0 1 1
1 0 1
1 1 0
00 10 10
10 11 01
etc...
XOR can also be represented by A&~B | ~A&B
Precedence: (Highest to lowest)
~ & (| ^)
You can change the precedence by using ().
NAND is basically NOT AND, so you do the ANDING and then invert the
result. Same with NOR.
Some rules:
Anything AND 0 == 0
Anything AND 1 == itself
Anything OR 1 == 1
Anything OR 0 == itself
Anything NAND 0 == 1
Anything NAND 1 == not itself
Anything NOR 1 == 0
Anything NOR 0 == not itself
Philip
--
"The only way for a reporter to look at a politician is down."
-- H.L. Mencken
_______________________________________________
Linuxers mailing list
[EMAIL PROTECTED]
http://ilug-bom.org.in/mailman/listinfo/linuxers