From 73365f4721e45741eef2eb827bf7572fb31cf9f7 Mon Sep 17 00:00:00 2001 From: mdb Date: Fri, 7 Jul 2006 17:15:59 +0000 Subject: [PATCH] It's too hot today. I realize now that what was going on wasn't entirely stupid as it caught the 0/0 case and freaked out in the >0/0 case. I'll just sheepishly change this all back and go fix the fucking webapp that's passing 1/0. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1873 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/velocity/DataTool.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java/com/samskivert/velocity/DataTool.java b/src/java/com/samskivert/velocity/DataTool.java index 7ddec4f2..802226ed 100644 --- a/src/java/com/samskivert/velocity/DataTool.java +++ b/src/java/com/samskivert/velocity/DataTool.java @@ -47,11 +47,11 @@ public class DataTool /** * Returns the numerator as a percentage of the denominator (100 * num / - * denom), handles 0/0 (returns 0) and returns 0 when denom is 0. + * denom), handles 0/0 (returns 0), but will div0 on N/0 where N != 0. */ public int percent (int num, int denom) { - return (denom == 0) ? 0 : 100 * num / denom; + return (num == 0) ? 0 : 100 * num / denom; } /**