10.03.2011, 17:20
Wow,great tut
I learned lot from this xD
I learned lot from this xD
0000 -- 0 0001 -- 1 0010 -- 2 0011 -- 3 0100 -- 4 0101 -- 5 0110 -- 6 0111 -- 7 1000 -- 8 1001 -- 9 1010 -- a 1011 -- b 1100 -- c 1101 -- d 1110 -- e 1111 -- f
0100 0010 1100 1101 0001 1101 0000 1111
42cd1d0f
0101 // 5 0111 // 7 +---------- 0212 // 2 is not a bit. That's why we move it to the left, like we do in decimal counting. 2 becomes 0 and we add a 1 to the digit on the left of it 0220 // stil 2's 0300 // zamg a 3. Remain a 1 and add a 1 to the digit on the left - like adding 11 in decimal 1100 // = 12. Worked So, a bit (inside joke) shorter: 111 0101 0111 +------ 1100 This was a difficult example, so I'll take an easier one for my short method: 1 // This is the one you get when you sum up the two ones on the right. 0010 // 2 0010 // 2 +---- 0100 // 4
Well, I was asking if you know something about general bits - not only those used in PAWN. I am learning about 64bit at university, but it wasn't clear for me at all, and it seems like you know a lot from it.
So we learned that, for doubles (64bits = 8 bytes for one rational = not complex number), the first bit returns whether it's positive or negative (same as in PAWN), the next 11 are the "exponents" and the other 52 are part of the "mantissa". I understand how the first number works, it's quite easy, but what about the other 11+52? Am I right if the first 11 are the same as in PAWN, the natural powers of 2? So just 00000100001 would be 2^5 + 2^0 = 33? But then that mantissa...no clue what it is, but it's about the decimal numbers (everything behind the comma). I just don't get how they define a rational number using those bits. What I'm currently thinking about, is that the last bit of the 52 is 2^-1, the one but last 2^-2 and so on...am I right? EDIT: I tried changing the hexadecimal wiki page (adding parts of my post referring to bits), but it says I need to log in. When I click on "Create Account", it refers me to the login page, and no single button "Create account" anywhere. |
That wasn't discovered by Slice, just happens to have been documented there. It has been documented before that too and is a method in use in other languages since long before SA:MP came out. It's actually a natively supported feature in C in the form of bit fields:
http://en.wikipedia.org/wiki/Bit_field |