Wow, how did I not notice that libbytesize doesn't use `ROUND_HALF_UP` (or even support it)?
My brain struggles mightily with the idea that `round_to_nearest('10.3')` would return `11` as opposed to `10` given that `10.3` is more than _twice_ as close to `10` than to `11`.
Since we are dealing with size quantities here I can see an argument for rounding up in certain situations, but it is still a mental hurdle for me. If the size represents a quantity used, rounding up seems to make sense (so that we do not under-estimate how much we have taken). But what if the size represents a quantity of free space? Rounding up seems to be a bad idea for this (because it leads us to over-estimate how much we have available). And what if we're relating two complementary sizes? `ROUND_HALF_UP` makes those kinds of relations sensible in general even when rounding.
Consider a `100 GiB` drive with a `44.2 GiB` partition and `55.8 GiB` of free space. If someone wanted to get a general feel for the situation, for example to display in a UI, here's what we'd see:
With `ROUND_UP`: ``` Disk Size: 100 GiB Used: 45 GiB Free: 56 GiB ```
With `ROUND_HALF_UP`: ``` Disk Size: 100 GiB Used: 44 GiB Free: 56 GiB ```
Which one do you think does a better job of representing the truth?
anaconda-patches@lists.fedorahosted.org