8
$\begingroup$
UnitConvert[Quantity[1, "GB"], "MB"]

Quantity[1000, "Megabytes"]

Which is NOT something we would normally expect. Is this a bug?

How can I use 1024MB = 1GB for the calculation?

Thanks.

$\endgroup$
3

2 Answers 2

19
$\begingroup$

You need to use 'better' units:

UnitConvert[Quantity[1, "GiB"], "MiB"]

Quantity[1024, "Mebibytes"]

See explanation and definitions in https://en.wikipedia.org/wiki/Gigabyte

$\endgroup$
6
$\begingroup$

Like the first answer said, you mean to use "GiB" and "MiB", the standard binary prefixes. These were set in place in the 90s to deal with this exact ambiguity, since everywhere but computing mega- and giga- referred to the standard metric prefixes based on powers of ten. Of course, powers of two are much more useful to us, so the new prefixes gibi- (1 GiB = 1024 MiB), mebi- (1 MiB = 1024 KiB), and so on were introduced.

You'll still see MB and GB used all over the place when people really mean MiB and GiB, though.

source: https://en.wikipedia.org/wiki/Binary_prefix

$\endgroup$
2
  • $\begingroup$ At the same time, although binary-based units seem to make sense for things like amount of memory on chips connected to memory buses and controllers, there's no particularly strong reason it to make sense on devices such as hard drives, and many standards especially in networking are explicitly of base 10. Consider 10 Gigabit Ethernet, for instance. Those gigabits are 10^9 bits, and there's no particular reason it to be otherwise. $\endgroup$
    – kirma
    Commented Apr 11, 2018 at 16:06
  • $\begingroup$ The GiB suffix was introduced specifically because hard disk manufacturers sell drives by calculating 1GB = 1000MB whereas most other devices use 1GB = 1024MB. I believe people tried to sue hard disk manufacturers but I can't remember the case. The manufacturers won because 1 Giga Something does not equal 1 Mega Something according to the standards bodies that defined the meanings for Giga, Mega, Tera, Kilo, Mili, Micro etc. $\endgroup$
    – slebetman
    Commented Apr 12, 2018 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.