double addition problem
Posted on 2002-07-01
Could someone please tell me what might be wrong. When I display the grand total I get lots of zero's that I don't want.
double _totalBalance = 0.0;
double paymentAmount = 0.00;
double pendingPaymentTotal = 0.00;
//retrieve from db
paymentAmount = rs.getDouble("Amount_Paid");
pendingPaymentTotal += paymentAmount;
//get the total balance
_totalBalance += pendingPaymentTotal;
//This shows the correct balance
These are the two balances that make up the one below that is message up:
sb.append("<td><b>" + String.valueOf(pendingPaymentTotal) + "</b></td>");
//This show lots of zero's that should not be visible.