BlaiseItUp / kahuna

0 stars 0 forks source link

Number Bases #2

Open BlaiseItUp opened 3 years ago

BlaiseItUp commented 3 years ago

In the next assignment we will discuss some of the different datatypes, and how they differ between C#, TSQL, and Javascript. Before we do, this assignment builds some base knowledge on numbers.

Bases.xlsx

ssavely commented 3 years ago

Had a hard time figuring out 64-65 and 255-256 Bases HW.xlsx

BlaiseItUp commented 3 years ago

So with binary each place is double the place to the right. So if you have a two digit binary number, lets say 11, the 1 on the left is 2 and the one on the right is 1, so this is the binary for 3.

It always helps me to look at binary in columns:

64| 32 | 16 | 8 | 4 | 2 | 1 each new digit to the left doubles the one to the right, so 64 is 1000000, and 65 would put a 1 at the end 1 0 0 0 0 0 0 if we add 64 + 32 + 16 + 8 + 4 + 2 + 1 = 127, that is one shy of 128 which would be the next digit

So 64 doubled is 128, then the next is 256. 255 will be all of the digits as 1 without the 256 place column 11111111, and 256 will be the next column added as a 1 and all the rest zeroes 100000000

256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 1 1 1 1 1 1 1 1 = 255

256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 1 0 0 0 0 0 0 0 0 = 256

When I look at hex it takes a minute to count by 16 in my head, but think of it like this, every multiple of 16 is like counting by 10 in base 10. 16 = 10 32 = 20 48 = 30 64 = 40 80 = 50 96 = 60 112 = 70 128 = 80 and so on. So 256 is 16 16. 10 16 = 160, so 256 as hex is 160 To look at 255 we know we need to take away one, but in our base 10 brains it makes us want to put 159, but that is not right. Let's start at the previous multiple of 16, 240, which is 150 in hex because for every 10 we count in B10 it is 16 in hex B10 Hex 240 = 150 241 = 151 242... 249 = 159 250 = 15A 251 = 15B 252 = 15C 253 = 15D 254 = 15E 255 = 15F Then the jump 256 = 160