Bug 209314 - Reconsider WTF:KB, WTF::MB, WTF::GB
Summary: Reconsider WTF:KB, WTF::MB, WTF::GB
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-19 15:24 PDT by Michael Catanzaro
Modified: 2020-03-19 15:26 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2020-03-19 15:24:44 PDT
We have, in StdLibExtras.h:

static constexpr size_t KB = 1024;
static constexpr size_t MB = 1024 * 1024;
static constexpr size_t GB = 1024 * 1024 * 1024;

That's actually KiB, MiB, and GiB. We should call them KiB, MiB, and GiB, not KB, MB, GB. KB would be 1000 (10^3). MB would be 10^4. GB would be 10^5.

This isn't pedantic, it's something that's important to be precise about since there's a big difference between the units. It can be extremely confusing when precision is required and the units are not as expected.

E.g.:

https://duckduckgo.com/?q=500+GB+to+GiB&ia=answer
https://en.wikipedia.org/wiki/Orders_of_magnitude_(data)
Comment 1 Michael Catanzaro 2020-03-19 15:26:51 PDT
(In reply to Michael Catanzaro from comment #0)
> MB would be 10^4. GB would be 10^5.

This will live on the internet forever to embarrass me. Yes, that's not how math works. MB is 10^6 and GB is 10^9....