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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user