Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying file size: 1000b = 1kb or 1024b = 1kb?

Tags:

file

ios

byte

size

I am making a iOS app where the size of some files is diplayed in MB. My question is if it is correct to calculate 1000 byte = 1kb or 1024 byte = 1kb ? I have seen that Finder on the mac calculates with 1000b, but an iOS file manager called iFile calculates with 1024b. The wikipedia article didn't really answer my question. I am just askig speifically for file size not HD capacity etc.

like image 839
JonasG Avatar asked Dec 26 '11 00:12

JonasG


People also ask

Is 1 KB 1024 bytes or 1000 bytes?

Therefore 1KB must equal 1024 Bytes, 1MB must equal 1048576 Bytes (1024x1024) etc. Any non-computing reference to Kilo/Mega etc. Is based on the decimal 1000 base, eg.

Why is 1kb 1024 bytes and not 1000 bytes?

The closest base number to a thousand (kilo) is 1024, hence it was abbreviated to k, so 1024 bytes = 1kb.

Is 1kb 1024 bytes correct?

KB does and has always meant 1024 bytes.

Which is a valid statement 1kb 1000 bytes 1MB 1024 kilobytes 1gb 1024 bytes 1gb 1000 bytes?

correct option is (a) 1kb = 1024 bytes.


1 Answers

My question is if it is correct to calculate 1000 byte = 1kb or 1024 byte = 1kb ?

Both are correct, and both are used in different situations.

1024 is more common for file sizes, while 1000 is more common for physical disk sizes, but neither is always used that way. As you mentioned, some programs uses 1000 for file sizes, and for memory cards 1024 is often used rather than 1000.

An example of how inconsistently the units are used is the 1.44 MB floppy disk. It's neither 1.44 * 1000 * 1000 bytes nor 1.44 * 1024 * 1024 bytes, but actually 1.44 * 1000 * 1024 bytes.

An effort was made to introduce the kibibyte unit, which is always 1024 bytes. It never was a hit, but you can see it used sometimes.

like image 138
Guffa Avatar answered Sep 27 '22 18:09

Guffa