Skip to main content
GameDev.net gamedev.net
🔒 Locked

How many bytes in a megabyte?

Started by superpig Aug 6, 2003 at 3:23 AM 84 replies 20.4k views
Original Post
superpig
superpig
Is it 1000000 (1000*1000) or 1048576 (1024*1024)? Or rather, if I wanted to allocate blocks of around 1mb each, which size should I use? I guess OS memory managers might prefer one over the other... Superpig - saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
Alimonster
Alimonster
The second - there are 1024 bytes in a kilobyte, and 1024 kilobytes to a megabyte. So (1024*1024), in short.
superpig
superpig
OK, thanks. I thought the first was too neat to be right.

Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
mputters
mputters
And you''re writing articles? hahah
Anyway :

K = 2^10
M = 2^20
G = 2^30
T = 2^40

etc...
dagarach
dagarach
Not since 1998.

Since then, there have been 1000000 bytes in a megabyte and 1000 bytes in a kilobyte.
mputters
mputters
quote:
Original post by dagarach
Not since 1998.

Since then, there have been 1000000 bytes in a megabyte and 1000 bytes in a kilobyte.


Yup, and 1024 meters in kilometer.
dagarach
dagarach
Nope:
1024 metres in a kibimetre.
1000 metres in a kilometre.
1024 bytes in a kibibyte.
1000 bytes in a kilobyte.
mputters
mputters
You''re the only one who cares about what that comission said about using Ki ;p
Nervo
Nervo
Then how come my computer's hard drive like everyone elses computes using a base 2 to multiple powers of ten to show hard drive space. How come when an adveriser says a hard drive at "80 Gigabytes" I notice it is closer to "75 Gigabytes"? Surely it is plain to see computers don't use base 10 computation and that the OP was correct in his assertion.

EDIT: I see your point Dagarach, you are correct also, its just that no one seems to fall in line with it.

Here is an excerpt from a website glossary:

kilo- (k-) [2]
in measuring the memory of a computer, the prefix kilo- often means 2^10 = 1024 instead of 1000. By a 1998 resolution of the International Electrotechnical Commission, the new prefix kibi- (Ki-) should replace kilo- for 2^10. However, this doesn't seem to be happening. ROOFLES!!




[edited by - nervo on August 6, 2003 7:18:12 AM]
Well, R2D22U2..
Xgkkp
Xgkkp
Quick Quiz! How many Meters in a Decameter?
Nervo
Nervo
Uhhh 2 squared?


King Henry Died Drinking Chocolate Milk..... Um, 10 then!
Well, R2D22U2..
dagarach
dagarach
Don''t come crying to me when your Mars probe crashes from a 24 byte buffer overrun.

I don''t care really, but the current system can be confusing. Hard drive sizes in gigabytes are normally power-of-ten gigas (IIRC), but other storage media normally use power-of-two kilo and mega. Thus leading to the problem that you can''t fit 1024 megabytes of data into 1 gigabyte of space on a hard-drive (you can''t even get 1000 in).

The next nasty situation you can get into is when the method changes across a step. Such that a gigabyte an one system might become 1024 * 1000.

Tyson
Tyson
How many square furlongs in a hectare

============================
A guy, some jolt, and a whole lot of code
============================A guy, some jolt, and a whole lot of code :)
Nervo
Nervo
Thats hard and stuff. What are the conversions?

BTW Dagarach you aren''t wrong at all as it appears you support the decisions of that convention but programmers are still like alot of people in that many resist change!
Well, R2D22U2..
superpig
superpig
quote:
Original post by mputters
And you''re writing articles? hahah


This is how I ensure they''re correct.

Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
vanillacoke
vanillacoke
Does anyone know what the advantage was supposed to be to using powers of 10 for K,M,G? It seems to me like whoever decided that doesn''t know how computers work...
You know what I never noticed before?
vanillacoke
vanillacoke
Does anyone know what the advantage was supposed to be to using powers of 10 for K,M,G? It seems to me like whoever decided that doesn''t know how computers work...
You know what I never noticed before?
Thrump
Thrump
quote:
Original post by vanillacoke
Does anyone know what the advantage was supposed to be to using powers of 10 for K,M,G? It seems to me like whoever decided that doesn''t know how computers work...


It reminds me of that state that decided PI should equal 3 to make things easier.
Nervo
Nervo
Talk about going backwards with the PI deal. Like going backwards to when the Greeks used 3 as the value of PI.
Well, R2D22U2..
dagarach
dagarach
vanillacoke: Absolutely right! The kilogram was an established standard before Babbage was a man.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.