Advertisement
mkv

binaries v2

mkv
May 19th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. aight, so bits have different powers based on where they're positioned, just like our regular digit system: the 1 in 1000 is a hundred times as valuable as the 1 in 10
  2.  
  3. the binary system assigns bits powers starting from 1, and from there on it's the last bit multiplied by two
  4.  
  5. 128 64 32 16 8 4 2 1 - values of bits in a "byte"
  6. 1 0 0 1 0 1 0 1 - the number stored in this byte
  7.  
  8. now, we'll simply add up the numbers above each high (1) bit: 128+16+4+1 = 149
  9.  
  10.  
  11.  
  12. naturally, this process works the other way around as well... say we have the number 167.
  13.  
  14. we'll start by finding the biggest power we can subtract from our number so it doesn't become negative. Right now it's 128, so we do 167-128 and get 39. Now we put a 1 below 128.
  15.  
  16. next, we can't subtract 64, so we put a 0 below that. 32 is fine, giving us 7 and a 1 below 32.
  17.  
  18. next number we can subtract is 4, putting 0 below 16 and 8, and 1 below 4... now we are only left with 3, putting a 1 below 2 and 1 as well
  19.  
  20. 128 64 32 16 8 4 2 1 - values of bits in a "byte"
  21. 1 0 1 0 0 1 1 1 - the calculated binary number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement