CSharpRules
asked on
double addition problem
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.
//global
double _totalBalance = 0.0;
//method scope
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:
Ex. 25196.67
Ex. 30627.23
sb.append("<td><b>" + String.valueOf(pendingPaym entTotal) + "</b></td>");
//This show lots of zero's that should not be visible.
Ex. 55823.899999999994
agScriptHelper.alert(Strin g.valueOf( _totalBala nce));
//global
double _totalBalance = 0.0;
//method scope
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:
Ex. 25196.67
Ex. 30627.23
sb.append("<td><b>" + String.valueOf(pendingPaym
//This show lots of zero's that should not be visible.
Ex. 55823.899999999994
agScriptHelper.alert(Strin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.objects.com.au/staff/mick
Brainbench MVP for Java 1
http://www.brainbench.com