Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0004512Openbravo ERPA. Platformpublic2008-07-25 18:132009-04-21 12:18
omlaverde 
vmromanos 
highmajoralways
closedfixed 
5
pi 
2.50 
Core
No
0004512: Float Point Errors
Double and float operations don't have required precision.
Test this java code:

String a="0.28";
System.out.println("Error="+Double.parseDouble("0.28")*100D);
System.out.println("OK="+new BigDecimal(a).multiply(new BigDecimal(100)));

System out:
Error=28.000000000000004
OK=28.00

Condition return false:
Double.parseDouble("0.28")*100D == 28D

And others errors ...
Search double,float in java code without Case sensitive in src directory.
- double 473 hits.
- float 75 hits.
Change all double, float, Double, Float types to BigDecimal. Change all operators (+,-,/,*) to BigDecimal methods.
- double 473 hits.
- float 75 hits.
GPS-Top20
has duplicate defect 0006284 closed Dowid Use of double instead of BigDecimal, double is very inprecise 
related to backport 0006477 closed vmromanos Use of double instead of BigDecimal, double is very inprecise 
related to defect 0008098 closed shuehner Double representation should not be used for numbers as it is inprecise 
Issue History
2008-07-25 18:13omlaverdeNew Issue
2008-07-25 18:13omlaverdeAssigned To => cromero
2008-07-25 18:13omlaverdesf_bug_id0 => 2027982
2008-07-25 20:51omlaverdeNote Added: 0008405
2008-07-30 10:59psarobeSeveritycritical => minor
2008-07-30 11:00psarobeStatusnew => scheduled
2008-07-30 11:00psarobeAssigned Tocromero => gorka_gil
2008-07-30 11:00psarobefix_in_branch => trunk
2008-08-20 16:58iperdomoAssigned Togorka_gil => vmromanos
2008-08-26 12:59plujanNote Added: 0008748
2008-08-26 12:59plujanSeverityminor => major
2008-08-26 12:59plujanfix_in_branchtrunk =>
2008-09-02 13:06cromeroTarget Version => 2.50
2008-09-18 11:55manjukaNote Added: 0009070
2008-09-30 13:07pjuvaraTag Attached: GPS-Top20
2008-12-03 19:03pjuvaraPrioritynormal => high
2008-12-10 10:27rafarodaRelationship addedrelated to 0006284
2008-12-31 17:14svnbotCheckin
2008-12-31 17:14svnbotNote Added: 0011822
2008-12-31 17:14svnbotsvn_revision => 11627
2009-01-07 15:43mtaalRelationship replacedhas duplicate 0006284
2009-01-07 18:39svnbotCheckin
2009-01-07 18:39svnbotNote Added: 0011961
2009-01-07 18:39svnbotsvn_revision11627 => 11692
2009-01-08 17:30svnbotCheckin
2009-01-08 17:30svnbotNote Added: 0011999
2009-01-08 17:30svnbotsvn_revision11692 => 11723
2009-01-08 19:25svnbotCheckin
2009-01-08 19:25svnbotNote Added: 0012008
2009-01-08 19:25svnbotsvn_revision11723 => 11729
2009-01-08 19:26svnbotCheckin
2009-01-08 19:26svnbotNote Added: 0012009
2009-01-08 19:26svnbotStatusscheduled => resolved
2009-01-08 19:26svnbotResolutionopen => fixed
2009-01-08 19:26svnbotsvn_revision11729 => 11730
2009-01-09 17:28svnbotCheckin
2009-01-09 17:28svnbotNote Added: 0012055
2009-01-09 17:28svnbotsvn_revision11730 => 11777
2009-01-09 18:22vmromanosRelationship addedrelated to 0006477
2009-03-12 16:35shuehnerRelationship addedrelated to 0008098
2009-04-21 12:18psarobeStatusresolved => closed

Notes
(0008405)
omlaverde   
2008-07-25 20:51   
Please read this:
http://www.ibm.com/developerworks/java/library/j-jtp0114/ [^]
(0008748)
plujan   
2008-08-26 12:59   
Severity changed to major. Please put special attention to those double and float variables that can lead to rounding errors.

For more information, see: https://sourceforge.net/forum/message.php?msg_id=5127475 [^]
(0009070)
manjuka   
2008-09-18 11:55   
Also suggest changing database column types to DECIMAL with precision 2 (or more where needed)
(0011822)
svnbot   
2008-12-31 17:14   
Repository: openbravo
Revision: 11627
Author: vmromanos
Date: 2008-12-31 17:14:52 +0100 (Wed, 31 Dec 2008)

Issue 4512: Float Point Errors

---
U trunk/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
U trunk/src/org/openbravo/erpCommon/ad_forms/DocPayment.java
U trunk/src/org/openbravo/erpCommon/ad_process/CreateAccountingReport.java
U trunk/src/org/openbravo/erpCommon/ad_process/CreateTaxReport.java
U trunk/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java
---

https://dev.openbravo.com/websvn/openbravo/?rev=11627&sc=1 [^]
(0011961)
svnbot   
2009-01-07 18:39   
Repository: openbravo
Revision: 11692
Author: vmromanos
Date: 2009-01-07 18:39:04 +0100 (Wed, 07 Jan 2009)

Issue 4512: Float Point Errors

---
U trunk/src/org/openbravo/erpCommon/ad_actionButton/ExpenseSOrder.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SE_Order_BPartner.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Conversion_Rate.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_CreateFromMultiple_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_CreateLines_Conversion_UOM.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_GlobalUse_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_InOut_BPartner.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_InOut_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Internal_Consumption_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_InvoiceTax_Amt.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Amt.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Movement_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Amt.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Order_DocType.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Production_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Project_Margin.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_Project_Planned.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Amt.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_RequisitionLine_Product.java
U trunk/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java
U trunk/src/org/openbravo/erpCommon/ad_process/CreateAccountingReport.java
U trunk/src/org/openbravo/erpCommon/ad_process/CreateTaxReport.java
U trunk/src/org/openbravo/erpCommon/ad_process/ImportOrder.java
U trunk/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java
U trunk/src/org/openbravo/erpCommon/ad_reports/MInOutTraceReports.java
U trunk/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java
---

https://dev.openbravo.com/websvn/openbravo/?rev=11692&sc=1 [^]
(0011999)
svnbot   
2009-01-08 17:30   
Repository: openbravo
Revision: 11723
Author: vmromanos
Date: 2009-01-08 17:30:13 +0100 (Thu, 08 Jan 2009)

Issue 4512: Float Point Errors

---
U trunk/src/org/openbravo/erpCommon/ad_actionButton/CopyFromOrder.java
U trunk/src/org/openbravo/erpCommon/ad_actionButton/CopyFromPOOrder.java
U trunk/src/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
U trunk/src/org/openbravo/erpCommon/ad_actionButton/CreateVatRegisters.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SE_Invoice_BPartner.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_MachineCost.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_SequenceProduct_Conversion.java
U trunk/src/org/openbravo/erpCommon/ad_process/ExpenseAPInvoice.java
U trunk/src/org/openbravo/erpCommon/ad_reports/ReportCashFlow.java
U trunk/src/org/openbravo/erpCommon/ad_reports/ReportProjectProgress.java
U trunk/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java
---

https://dev.openbravo.com/websvn/openbravo/?rev=11723&sc=1 [^]
(0012008)
svnbot   
2009-01-08 19:25   
Repository: openbravo
Revision: 11729
Author: vmromanos
Date: 2009-01-08 19:25:30 +0100 (Thu, 08 Jan 2009)

Issue 4512: Float Point Errors

---
U trunk/src/org/openbravo/erpCommon/businessUtility/AccountTree.java
---

https://dev.openbravo.com/websvn/openbravo/?rev=11729&sc=1 [^]
(0012009)
svnbot   
2009-01-08 19:26   
Repository: openbravo
Revision: 11730
Author: vmromanos
Date: 2009-01-08 19:26:41 +0100 (Thu, 08 Jan 2009)

Fixed bug 4512: Float Point Errors

---
U trunk/src/org/openbravo/erpCommon/ws/externalSales/ExternalSalesImpl.java
U trunk/src/org/openbravo/erpCommon/ws/externalSales/OrderLine.java
U trunk/src/org/openbravo/erpCommon/ws/externalSales/Payment.java
U trunk/src/org/openbravo/erpCommon/ws/externalSales/Product.java
U trunk/src/org/openbravo/erpCommon/ws/externalSales/ProductPlus.java
U trunk/src/org/openbravo/erpCommon/ws/externalSales/Tax.java
---

https://dev.openbravo.com/websvn/openbravo/?rev=11730&sc=1 [^]
(0012055)
svnbot   
2009-01-09 17:28   
Repository: openbravo
Revision: 11777
Author: vmromanos
Date: 2009-01-09 17:28:29 +0100 (Fri, 09 Jan 2009)

Issue 4512: Float Point Errors

---
U trunk/src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Amount.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SE_Expense_Product.java
U trunk/src/org/openbravo/erpCommon/ad_callouts/SL_InvoiceTax_Amt.java
U trunk/src/org/openbravo/erpCommon/ad_forms/DocPayment.java
---

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