After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 628044 - g_format_size_for_display format precision
g_format_size_for_display format precision
Status: RESOLVED DUPLICATE of bug 594918
Product: glib
Classification: Platform
Component: general
2.25.x
Other All
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-08-26 16:02 UTC by Morten Welinder
Modified: 2010-09-01 13:54 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Morten Welinder 2010-08-26 16:02:36 UTC
Right now g_format_size_for_display can produce such strings as

    1.1 KB
    50.1 KB
    914.1 KB

That is between 2 and 4 significant digits (or a wider range if you do not
consider an initial 1 a full significant digit).  That's too much.

Alternatively you can look at the worst-case rounding error for the displayed
result as varying between 5% and 0.05%

In order to produce more reasonable results, I propose that the format be
"%.0f" when the scaled number is >=99.5

That would also have the minor benefit of producing a string of more uniform
length leading to a less "bouncy" GUI when this function is used for, say,
data-left-to-transfer.
Comment 1 Christian Persch 2010-08-26 18:52:40 UTC
This was previously discussed in bug 594918, see esp. bug 594918 comment 27.
Comment 2 Christian Dywan 2010-09-01 13:54:49 UTC

*** This bug has been marked as a duplicate of bug 594918 ***