Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0008177Openbravo ERPA. Platformpublic2009-03-17 19:042009-04-22 00:01
shuehner 
shuehner 
normalmajorhave not tried
closedfixed 
5
2.40 
2.50 
Core
No
0008177: Calculations done by XmlEngine (i.e. sum) are done using double. which leads to calculation errors.
XmlEngine can do some calculations when rendering i.e. a report. Example total sum of some values shown in the rows.

This calculations are done using double which leads to errors. Depending on the output-formatting these errors are sometimes 'hidden' as the rounded value is by accident the correct value.
- Use the Payment Aging Balance report as example [1].
- Enter data to be shown in the report to either only show ten lines of Value '0.1' in some column or to include ten extra lines of value '0.1'. One way of entering data for this is to follow the description in the page ag [2]
- edit the config/Format.xml to change autoInform formatting to the following '#,##0.####################'
- See that the total value shown in the report is incorrect.


[1] Financial Management || Receivables & Payables || Analysis Tools || Payment Aging Balance || Payment Aging Balance
[2] http://wiki.openbravo.com/wiki/Talk:Demo_Script/Op01_Pending_receivables_by_date_ranges [^]
Change XmlEngine internal representation from double -> BigDecimal
No tags attached.
depends on backport 0008242 closed shuehner Calculations done by XmlEngine (i.e. sum) are done using double. which leads to calculation errors. 
related to defect 0008098 closed shuehner Double representation should not be used for numbers as it is inprecise 
related to defect 00121002.50MP14 closed dbaz Firefox doesn't add numbers correctly in Sales Management 
xml Format.xml (3,303) 2009-03-17 19:04
https://issues.openbravo.com/file_download.php?file_id=1009&type=bug
png xmlengine_doubles_std.png (81,394) 2009-03-17 19:04
https://issues.openbravo.com/file_download.php?file_id=1010&type=bug
png
Issue History
2009-03-17 19:04shuehnerNew Issue
2009-03-17 19:04shuehnerAssigned To => shuehner
2009-03-17 19:04shuehnerRegression testing => No
2009-03-17 19:04shuehnerFile Added: Format.xml
2009-03-17 19:04shuehnerFile Added: xmlengine_doubles_std.png
2009-03-17 19:05shuehnerNote Added: 0014740
2009-03-17 19:06shuehnerNote Added: 0014741
2009-03-17 19:06shuehnerRelationship addedrelated to 0008098
2009-03-23 19:30shuehnerStatusnew => scheduled
2009-03-23 19:30shuehnerfix_in_branch => pi
2009-03-24 12:40hgbotCheckin
2009-03-24 12:40hgbotNote Added: 0014895
2009-03-24 12:40hgbotStatusscheduled => resolved
2009-03-24 12:40hgbotResolutionopen => fixed
2009-03-24 12:40hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/217112210a5303d7f401b97d51c7723f322b17b7 [^]
2009-04-21 10:53psarobeStatusresolved => closed
2009-04-22 00:01anonymoussf_bug_id0 => 2778081
2010-02-02 21:22shuehnerRelationship addedrelated to 0012100

Notes
(0014740)
shuehner   
2009-03-17 19:05   
Added screenshot of incorrect calculation and Format.xml with the needed change.
(0014741)
shuehner   
2009-03-17 19:06   
Note: These incorrect calculation can happen with every XmlEngine-generated report doing calculations in the report (sum,avg,...) with the 'right' input values.
(0014895)
hgbot   
2009-03-24 12:40   
Repository: erp/devel/pi
Changeset: 217112210a5303d7f401b97d51c7723f322b17b7
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Tue Mar 24 12:40:34 2009 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/217112210a5303d7f401b97d51c7723f322b17b7 [^]

Fixed 8177: change xmlEngine calculations from using double -> BigDecimal

---
M src-core/src/org/openbravo/xmlEngine/FunctionAddValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionDivideValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionEqualValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionGtValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionLtValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionMaxValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionMedValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionMinValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionModuleValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionMultiplyValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionSubtractValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionSumValue.java
M src-core/src/org/openbravo/xmlEngine/FunctionTemplate.java
---