Quick lesson in binary math

by Administrator 29. June 2009 22:28

• Binary math is based on powers of 2, as opposed to powers of 10 for
decimal math.
– Whereas decimal math has a 1s place, 10s place, 100s place, and so forth…
– Binary math has a 1s place, 2s place, 4s place, 8s place, and so forth.
• Given an octet (8 bits), when a bit in the octet is set (1) its value is…
– 128 = left-most bit (most significant bit) = 27
– 64 = next bit = 26
– 32 = next bit = 25
– 16 = next bit = 24
– 8 = next bit = 23
– 4 = next bit = 22
– 2 = next bit = 21
– 1 = right-most bit (least significant bit) = 20
• When a bit in an octet is not set (0) its value is zero.
• The decimal value of an octet is the sum of each set bit’s value.
– 11000000 = 128 + 64 = 192
– 10101000 = 128 + 32 + 8 = 168
– 11111111 = 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

Tags:

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About the author

Each morning when I open my eyes I say to myself: I, not events, have the power to make me happy or unhappy today. I can choose which it shall be. Yesterday is dead, tomorrow hasn’t arrived yet. I have just one day, today, and I’m going to be happy in it

Month List

Page List