You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/03/25 23:21:18 UTC
[Bug 56315] New: Floating point rounding problems with ROUND
function
https://issues.apache.org/bugzilla/show_bug.cgi?id=56315
Bug ID: 56315
Summary: Floating point rounding problems with ROUND function
Product: POI
Version: 3.10
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: dev@poi.apache.org
Reporter: josteitv@pvv.ntnu.no
Created attachment 31438
--> https://issues.apache.org/bugzilla/attachment.cgi?id=31438&action=edit
Simple Java program and Excel sheet to reproduce the bug
When running the attached code I get the following output:
A1 numeric: 0.049999999999999975
A3 numeric: 0.0
A3 text: 0
A3 formatted: 0
A4 concatenated: test 0
If I open the spreadsheet in Excel it displays:
A1: 0.05
A3: 0.1
A4: test 0.1
The ROUND function in cell A3 returns 0.0 in POI, while it returns 0.1 in
Excel.
I assume this is because of the problems with storing exact floating point
numbers, but I really think POI and excel should return the same result.
When the value is used in a CONCATENATE function in cell A4, the result from
POI also differs from Excel.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56315] Floating point rounding problems with ROUND function
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56315
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56315] [PATCH] Floating point rounding problems with ROUND
function
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56315
Jostein Tveit <jo...@pvv.ntnu.no> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Floating point rounding |[PATCH] Floating point
|problems with ROUND |rounding problems with
|function |ROUND function
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56315] Floating point rounding problems with ROUND function
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56315
Jostein Tveit <jo...@pvv.ntnu.no> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #31438|0 |1
is obsolete| |
--- Comment #1 from Jostein Tveit <jo...@pvv.ntnu.no> ---
Created attachment 31453
--> https://issues.apache.org/bugzilla/attachment.cgi?id=31453&action=edit
[PATCH] Patch against trunk to solve this bug
I fixed this bug by using
new java.math.BigDecimal(NumberToTextConverter.toText(n))
instead of
java.math.BigDecimal.valueOf(n)
All other unit tests goes green, so I assume this solution is ok.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56315] Floating point rounding problems with ROUND function
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56315
Jostein Tveit <jo...@pvv.ntnu.no> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #31453|0 |1
is obsolete| |
--- Comment #2 from Jostein Tveit <jo...@pvv.ntnu.no> ---
Created attachment 31454
--> https://issues.apache.org/bugzilla/attachment.cgi?id=31454&action=edit
The patch including unit test against excel spreadsheet
I'm adding the patch and the tar.gz separately
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56315] [PATCH] Floating point rounding problems with ROUND
function
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56315
spuyo84@gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56315] [PATCH] Floating point rounding problems with ROUND
function
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56315
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
Thanks for the patch, this is applied with r1588538 with some additional
testing in TestMathX.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 56315] Floating point rounding problems with ROUND function
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56315
--- Comment #3 from Jostein Tveit <jo...@pvv.ntnu.no> ---
Created attachment 31455
--> https://issues.apache.org/bugzilla/attachment.cgi?id=31455&action=edit
The patch as text file
I'm adding the patch and the tar.gz separately
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org