Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0006477Openbravo ERPA. Platformpublic2008-12-11 09:402009-03-03 17:16
mtaal 
vmromanos 
highmajoralways
closedfixed 
5
 
 
Core
No
0006477: Use of double instead of BigDecimal, double is very inprecise
There are a few cases in Openbravo source code where a double type is used. A double is far more in-precise than a BigDecimal. Always a BigDecimal should be used.
See for example this code in the ReportGeneralLedger class:
        double amount = 0.0;
        for (int i=0;data2!=null && i<data2.length;i++){
          if (data2[i].factAcctId.equals(data[0].factAcctId)) {
            if (log4j.isDebugEnabled()) log4j.debug("break i:"+i);
            break;
          };
          // if (data2[i].id.equals(data[0].id))
          if ((data2[i].partner.equals(data[0].partner) && (!(strcBpartnerId.equals("")&&(strAll.equals("")))))||(strcBpartnerId.equals("")&&(strAll.equals(""))))
            amount += Double.valueOf(data2[i].total).doubleValue();
        }

Here a BigDecimal should be used.

Search for the use of double in the source tree and repair the incorrect uses.
No tags attached.
related to defect 00045122.50 closed vmromanos Float Point Errors 
blocks defect 0006284 closed Dowid Use of double instead of BigDecimal, double is very inprecise 
Issue History
2008-12-11 09:40DowidNew Issue
2008-12-11 09:40DowidAssigned To => Dowid
2008-12-11 09:40DowidStatusnew => scheduled
2009-01-08 10:28DowidAssigned ToDowid => vmromanos
2009-01-09 18:22vmromanosRelationship addedrelated to 0004512
2009-01-09 18:34svnbotCheckin
2009-01-09 18:34svnbotNote Added: 0012070
2009-01-09 18:34svnbotStatusscheduled => resolved
2009-01-09 18:34svnbotResolutionopen => fixed
2009-01-09 18:34svnbotsvn_revision => 11782
2009-03-03 17:16psarobeStatusresolved => closed

Notes
(0012070)
svnbot   
2009-01-09 18:34   
Repository: openbravo
Revision: 11782
Author: vmromanos
Date: 2009-01-09 18:34:48 +0100 (Fri, 09 Jan 2009)

Fixed bug 6477: Use of double instead of BigDecimal, double is very imprecise (Float Point Errors)

---
U branches/r2.40/src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_BPartner.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SE_Order_BPartner.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Conversion_Rate.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_CreateFromMultiple_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_GlobalUse_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_InOut_BPartner.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_InOut_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_InvoiceTax_Amt.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_MachineCost.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Movement_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Order_DocType.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Production_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Project_Margin.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_Project_Planned.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Product.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Conversion.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_forms/DocPayment.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_forms/MatchingPOReceiptInvoice.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_process/CreateAccountingReport.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_process/CreateTaxReport.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_process/ImportOrder.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_reports/ReportCashFlow.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java
U branches/r2.40/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java
U branches/r2.40/src/org/openbravo/erpCommon/businessUtility/AccountTree.java
U branches/r2.40/src/org/openbravo/erpCommon/ws/externalSales/ExternalSalesImpl.java
U branches/r2.40/src/org/openbravo/erpCommon/ws/externalSales/OrderLine.java
U branches/r2.40/src/org/openbravo/erpCommon/ws/externalSales/Payment.java
U branches/r2.40/src/org/openbravo/erpCommon/ws/externalSales/Product.java
U branches/r2.40/src/org/openbravo/erpCommon/ws/externalSales/ProductPlus.java
U branches/r2.40/src/org/openbravo/erpCommon/ws/externalSales/Tax.java
---

https://dev.openbravo.com/websvn/openbravo/?rev=11782&sc=1 [^]