1000 kilobytes != 1mb and 1000b != 1kb, why?
I figured I''ll need this some day. Right now it doesn''t seem very logical. Anyone care to explain it?
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-
a computer (cpu, memory etc) only understands binary numbers 0 and 1, this is a number system that we people dont use, we use the 10 number system.
the computer calculates in bits, so say 8 bits what is that in 10 number system 2^n -> 2^8 = 256 bytes
so 1 kilobyte is 2^10 = 1024 bytes
so 1 megabyte is 2^20 = 1024576 bytes
Hope this help you to understand :-)
(sory for my bad english)
-Vissing-
Edited by - vissing on August 20, 2001 2:44:00 PM
the computer calculates in bits, so say 8 bits what is that in 10 number system 2^n -> 2^8 = 256 bytes
so 1 kilobyte is 2^10 = 1024 bytes
so 1 megabyte is 2^20 = 1024576 bytes
Hope this help you to understand :-)
(sory for my bad english)
-Vissing-
Edited by - vissing on August 20, 2001 2:44:00 PM
-Vissing-
Basically, 1024 was nicer to the computer, and it was so close to 1000 that they decided to use it.
Yeah, thanks, it makes some sense now. I''m not completely familiar with binary though. I know how to count upwards in binary, but direct converting from one to another isn''t really my forté.
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-
just to nitpick, 2^20 is 1048576
Also, converting from binary->decimal and decimal->binary is pretty easy, even easier if you have a newish calculator
Binary -> Decimal
This is the easiest, if you have a number like 01101001:
You just use a formula like this:
Decimal -> Binary
This one is a bit more tricky, but basically, if you're converting to an 8-bit binary number, you first see if 2^7 is smaller than the number, if so, set bit 7 and subtract 2^7. Continue with 2^6, 2^5, etc. So, for 105, you go like this:
There you go!
If course, it's much easier doing it with a calculator, though You could write a program to do it for you as well (if you look at the GD.net mouse pad post, you'll see that a lot of people did that so they could "read" the binary on the mouse pad)
War Worlds - A 3D Real-Time Strategy game in development.
Edited by - Dean Harding on August 21, 2001 6:25:27 AM
Also, converting from binary->decimal and decimal->binary is pretty easy, even easier if you have a newish calculator
Binary -> Decimal
This is the easiest, if you have a number like 01101001:
+------------+---+---+---+---+---+---+---+---+| Bit Number | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |+------------+---+---+---+---+---+---+---+---+| Binary | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |+------------+---+---+---+---+---+---+---+---+
You just use a formula like this:
number = (0 * 2^7) + (1 * 2^6) + (1 * 2^5) + ... + (0 * 2^1) + (1 * 2^0) = 105
Decimal -> Binary
This one is a bit more tricky, but basically, if you're converting to an 8-bit binary number, you first see if 2^7 is smaller than the number, if so, set bit 7 and subtract 2^7. Continue with 2^6, 2^5, etc. So, for 105, you go like this:
number = 105binary = 00000000 is 105 >= 2^7 = 128? no. is 105 >= ? yes. number -= 64, = 41 binary = 01000000 is 41 >= 2^5 = 32? yes number -= 32, = 9 binary = 01100000 is 9 >= 2^4 = 16? no is 9 >= 2^3 = 8? yes number -= 16, = 1 binary = 01101000 is 1 >= 2^2 = 4? no is 1 >= 2^1 = 2? no is 1 >= 2^0 = 1? yes number -= 1, = 0 binary = 01101001
There you go!
If course, it's much easier doing it with a calculator, though You could write a program to do it for you as well (if you look at the GD.net mouse pad post, you'll see that a lot of people did that so they could "read" the binary on the mouse pad)
War Worlds - A 3D Real-Time Strategy game in development.
Edited by - Dean Harding on August 21, 2001 6:25:27 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement