Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0006284Openbravo ERPA. Platformpublic2008-11-30 23:102009-01-07 15:43
mtaal 
Dowid 
highmajoralways
closedduplicate 
5
 
 
Core
No
0006284: 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.
duplicate of defect 00045122.50 closed vmromanos Float Point Errors 
depends on backport 0006477 closed vmromanos Use of double instead of BigDecimal, double is very inprecise 
Issue History
2008-11-30 23:10mtaalNew Issue
2008-11-30 23:10mtaalAssigned To => rafaroda
2008-11-30 23:10mtaalsf_bug_id0 => 2367178
2008-11-30 23:10mtaalRegression testing => No
2008-12-01 13:00shuehnerIssue Monitored: shuehner
2008-12-03 19:03pjuvaraPrioritynormal => high
2008-12-09 12:52pheenanAssigned Torafaroda => Dowid
2008-12-10 10:27rafarodaRelationship addedrelated to 0004512
2008-12-10 10:28rafarodaNote Added: 0011117
2008-12-11 09:40DowidStatusnew => scheduled
2008-12-11 09:40Dowidfix_in_branch => trunk
2009-01-07 15:41vmromanosNote Added: 0011952
2009-01-07 15:43mtaalRelationship replacedduplicate of 0004512
2009-01-07 15:43mtaalStatusscheduled => closed
2009-01-07 15:43mtaalDuplicate ID0 => 4512
2009-01-07 15:43mtaalResolutionopen => duplicate

Notes
(0011117)
rafaroda   
2008-12-10 10:28   
Please take a look at the related issue and if it is duplicated, close one of them.
(0011952)
vmromanos   
2009-01-07 15:41   
This issue is duplicating 0004512. Please close this one because I am currently working on 0004512