I also count byte sizes in floating point to avoid overflows, but certainly not for memory allocations. No problem for me, as my code does not have to be very fast when calculating things. And because I convert to floating point anyway, as I want to display human-readable sizes with %.3f digits.
Posted Apr 18, 2012 23:34 UTC (Wed) by cmccabe (guest, #60281)
[Link]
I doubt that using floats rather than 64-bit integers is saving you any typing.
PHP: a fractal of bad design (fuzzy notepad)
Posted Apr 19, 2012 8:15 UTC (Thu) by juliank (subscriber, #45896)
[Link]
It doesn't when counting, but since I have to convert to double later on anyway, I can just count in double as well.
I could perhaps rewrite the human-readable size formatting to use integers (i.e. print B,KiB,MiB,GiB, TiB), but if I want precision after the period, things will start to get more complicated. And I usually want that precision.