0๐
โ
MiB = 1,024 * 1,024 Bytes
GB = 1,000 * 1,000 * 1,000 Bytes
Therefore you first have to multply your value by 1,024^2 and after that divide it by 1,000^3.
Your code should be something like this: (label * 1048576) / 1000000000
(yes, that is equivalent to your calculation).
Anyway, I guess the return value of your API is not in MiB, because the result of the calculation is 3 dimension to large.
Source:stackexchange.com