On Jan 09, 2025, Stefan Monnier wrote: > > For example...let's take the 18000000000000B drive discussed earlier. That's > > 18TB or 16TiB. Annoying, but ok. Now that's also 18000MB but 16763MiB. And > > it's 18000000MB or 17166137MiB. So if you have a display in MB and you want > > to know the value in TB you move the decimal 6 places. But if you move the > > decimal 6 places to get from MiB to TiB you get...the wrong answer. Does > > this actually happen? Yes. All the freaking time. (A classic mashup is 1024k > > blocks expressed with power of 10 M and G.) > > 🙂 > > A related problem is when writing code which displays such sizes in > a human readable way, for example a "speedometer" displaying the number > of bytes per second with a limited amount of space. A common choice is > to use 3 chars for the number plus a unit, i.e. things like "254 kB/s" > or "1.5 MB/s". Now, if you use the "1024" multiplier, you get a funny > quirk when the current speed is, say 1003 kB/s, because "1003 kB/s" uses > one char too many, yet we haven't reached "1.0 MB/s" either.
Thankfully, networking stuck with base-10 numbers for bitrates. -- |_|O|_| |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860
signature.asc
Description: PGP signature