Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0008098Openbravo ERPA. Platformpublic2009-03-12 16:352009-04-22 00:01
shuehner 
shuehner 
highmajoralways
closedfixed 
5
pi 
2.50 
Core
No
0008098: Double representation should not be used for numbers as it is inprecise
Double's are still used as intermediate representation in two places. Depending on values and configured precision this leads to wrong numbers displayed to the user.

XmlEngine/DataGrid (still) use Double when formatting according to formats defined in Format.xml
- Go to MRP -> Manufacturing plan
- Enter a header
- Enter a single line
- Execute the following sql in the underlying database (just to shortcut the process of entering this value):
update mrp_run_productionline set qty = '0.77777777777777777777777777';
- Last step changes the quantity of all Manufacturingplan lines to this value.
- edit config/Format.xml
  change the formatOutput value for "qtyRelation" to "#,##0.###############################"
- display the manufacturing plan line again and so that not the correct value (as entered in the update step) is displayed but a different one.
- The correct value should be displayed as the configured Format.xml entry has more digits as the example quantity value.
Fix XmlEngine & DataGrid to not use double as intermediate format when formatting numbers.

No tags attached.
related to defect 00045122.50 closed vmromanos Float Point Errors 
related to defect 0008177 closed shuehner Calculations done by XmlEngine (i.e. sum) are done using double. which leads to calculation errors. 
depends on backport 0008134 closed shuehner Double representation should not be used for numbers as it is inprecise 
png issue-8098.png (15,830) 2009-03-12 16:45
https://issues.openbravo.com/file_download.php?file_id=988&type=bug
png
Issue History
2009-03-12 16:35shuehnerNew Issue
2009-03-12 16:35shuehnerAssigned To => rafaroda
2009-03-12 16:35shuehnerRegression testing => No
2009-03-12 16:35shuehnerRelationship addedrelated to 0004512
2009-03-12 16:39shuehnerNote Added: 0014617
2009-03-12 16:45shuehnerFile Added: issue-8098.png
2009-03-12 16:45shuehnerNote Added: 0014618
2009-03-16 11:39rafarodaAssigned Torafaroda => shuehner
2009-03-16 11:39rafarodaPrioritynormal => high
2009-03-16 11:39rafarodaStatusnew => scheduled
2009-03-16 11:39rafarodafix_in_branch => pi
2009-03-17 19:06shuehnerRelationship addedrelated to 0008177
2009-03-18 13:50hgbotCheckin
2009-03-18 13:50hgbotNote Added: 0014784
2009-03-18 13:50hgbotStatusscheduled => resolved
2009-03-18 13:50hgbotResolutionopen => fixed
2009-03-18 13:50hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2f1991b64f1adae427c6863f6accafe5a86a367b [^]
2009-04-21 10:33psarobeStatusresolved => closed
2009-04-22 00:01anonymoussf_bug_id0 => 2778073

Notes
(0014617)
shuehner   
2009-03-12 16:39   
I did not verify but this bug is probably present backwards other version too (2.40,2.35,...)
(0014618)
shuehner   
2009-03-12 16:45   
Attached file with screenshot for the described case.
(0014784)
hgbot   
2009-03-18 13:50   
Repository: erp/devel/pi
Changeset: 2f1991b64f1adae427c6863f6accafe5a86a367b
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Wed Mar 18 13:43:55 2009 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/2f1991b64f1adae427c6863f6accafe5a86a367b [^]

Fixed 8098: changed outputformatting in edit & grid view to not use double as intermediate representation
Use BigDecimal instead to avoid floating point problems

---
M src-core/src/org/openbravo/xmlEngine/FieldValue.java
M src/org/openbravo/erpCommon/utility/DataGrid.java
---