Name: Anonymous 2009-08-13 11:57
Dearest /prog/,
This is an actual snippet of production code from a jsp application used by the US health-care system, which I have the misfortune to be developing on. This is not a joke.
This is an actual snippet of production code from a jsp application used by the US health-care system, which I have the misfortune to be developing on. This is not a joke.
public String rnd(double e, double d, int numDigits)
{
String t;
int tempDouble;
double f;
//e=16.47;
//d=47.023;
//out.print(e + " + " + d);
f= e / d;
//out.print("<br>" + f);
//out.print("<br>f=" + f);
tempDouble=(int)((f)* Math.pow(10,numDigits+1));
//out.print("<br>tempDouble=" + tempDouble);
f=(double)tempDouble;
f=f/10;
f=Math.round(f);
//out.print("<br>f=" + f);
//out.print("<br>" +tempDouble + " " + f/Math.pow(10,numDigits));
t=Double.toString(f/Math.pow(10,numDigits));
if (t.substring(t.indexOf('.'),t.length()).length() < numDigits+1)
t=t+'0';
//out.print("<br>" + t);
if (t.compareTo("0.00")==0)
t="0.0";
return t;
}