1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

Fix ratio calculation to not truncate to a whole number.

This commit is contained in:
Josh Elsasser 2006-02-09 18:16:36 +00:00
parent 9545453d48
commit 78aa41ac5e

View file

@ -90,7 +90,7 @@ ratiostr(guint64 down, guint64 up) {
/* this is a UTF-8 infinity symbol */ /* this is a UTF-8 infinity symbol */
return g_strdup(_("\xE2\x88\x9E")); return g_strdup(_("\xE2\x88\x9E"));
ratio = up / down; ratio = (double)up / (double)down;
return g_strdup_printf("%.*f", (10.0 > ratio ? 2 : (100.0 > ratio ? 1 : 0)), return g_strdup_printf("%.*f", (10.0 > ratio ? 2 : (100.0 > ratio ? 1 : 0)),
ratio); ratio);