Closed dankamongmen closed 5 years ago
As the values get larger, this obviously approaches the correct value more and more closely:
> (23437752319 - 2048 + 1) * 512
12000128139264
> 12000128139264 % (1024 * 1024 * 1024 * 1024)
1005011861504
> (1005011861504 * 100) / (1024 * 1024 * 1024 * 1024)
91.405296325683594
> (1005011861504) / ((1024 * 1024 * 1024 * 1024 + 99) /100)
91.405296317453463
but at low values, it's quite off, and either way it's weird as hell.
Fixed in whatever follows 1.6.0.2.
While working on #10, I looked at this, and was like, "that can't be right":
So I'm clearly trying to get a percentage for the mantissa, but...that's not how it's done, son. And indeed:
Unless there's something else at work here, 23437770751 - 23437770719 + 1 -> 33 sectors. At 512 each, that's 16896 bytes. 16896 % 1024 is 512, which is exactly half a kibibyte. We instead show 16.46, which is indeed 512 / ((1024 + 99) / 100). The correct display is 16.50.
The formula we want, I'm pretty sure, is (val % dv) * 100 / dv. I'm not sure where that other one came from.