Page 2 of 2

Re: Wrong amount returned by FileSize()

Posted: Wed Nov 23, 2022 10:02 am
by collectordave
Seems to be same problem.


Maybe a little confused.

I have a file on my hard drive which in finder is shown with a size of 16,3MB.

When I use FileSize() on the file it returns 16295002 which I assume are bytes

Now I thought that there are 1048576 bytes in a mega byte so in 16,3MB should there not be 1709152,8 bytes approx?

Re: Wrong amount returned by FileSize()

Posted: Wed Nov 23, 2022 1:32 pm
by nsstudios
I'd still consider it a bug if the x86 and x64 compilations don't perform the same way, unless it's actually a certain limitation.
About 16295002 being 16.3 MB, I believe this is the case of good ol' base 10 vs base 2 shenanigans (MB vs MiB). If we divide 16295002 by 1000000, then we get 16.295002 MB, which they appear to round up, but why they don't use MiB instead is beyond me.
Looking it up, this link seems to confirm my theory: https://support.apple.com/en-us/HT201402

Re: Wrong amount returned by FileSize()

Posted: Wed Nov 23, 2022 2:22 pm
by collectordave
Yes it does appear that Apple have decided that there are 1000 bytes in a kilobyte etc.

So 50 years of learning that there are 1024 bytes in a kilobyte all for nothing.

Apple cheating me out of 2.5% of storage space?