print_percentage: Use floating point to avoid incorrect results when

portion*100 overflows.
This commit is contained in:
Paul N. Hilfinger 2004-03-20 09:53:03 +00:00
parent 44349745f2
commit b2ba182e8f
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2004-03-20 Paul Hilfinger <hilfingr@nile.gnat.com>
* bcache.c (print_percentage): Use floating point to avoid
incorrect results when portion*100 overflows.
2004-03-19 Kevin Buettner <kevinb@redhat.com>
* ppc_tdep.h (ppc_linux_frame_saved_pc)

View File

@ -303,7 +303,7 @@ print_percentage (int portion, int total)
if (total == 0)
printf_filtered ("(not applicable)\n");
else
printf_filtered ("%3d%%\n", portion * 100 / total);
printf_filtered ("%3d%%\n", (int) (portion * 100.0 / total));
}