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 2012/04/13 16:06:27 UTC

DO NOT REPLY [Bug 53076] New: cell.getNumericCellValue() returns incorrect results sometimes

https://issues.apache.org/bugzilla/show_bug.cgi?id=53076

             Bug #: 53076
           Summary: cell.getNumericCellValue() returns incorrect results
                    sometimes
           Product: POI
           Version: 3.6
          Platform: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: rohit.vats@gmail.com
    Classification: Unclassified


Created attachment 28604
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28604
File demonstrating the bug

In an excel sheet processed through poi, getNumericCellValue() returned an
incorrect result for a decimal value. The file is attached. The issue happens
with the "Quantity" field of the first second row (-23,530.9150).

Value in .xls file: -23,530.9150
Formatting: Category - Number, Decimal Places - 4, Use 1000 separator - True
Value returned by getNumericCellValue: -23530.915000000045

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 53076] cell.getNumericCellValue() returns incorrect results sometimes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53076

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Nick Burch <ni...@alfresco.com> 2012-04-13 14:12:18 UTC ---
getNumericCellValue() returns the number stored in the file, which is a
floating point. If you want a string that looks the same as excel shows, use
something like DataFormatter to format your number

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 53076] cell.getNumericCellValue() returns incorrect results sometimes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53076

--- Comment #2 from rohit.vats@gmail.com 2012-04-13 15:27:00 UTC ---
Ok, the actual value in the field seems to be -23530.915, which is why I
wondered why getNumericCellValue() returned -23530.915000000045.

Any thoughts?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 53076] cell.getNumericCellValue() returns incorrect results sometimes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53076

--- Comment #4 from Nick Burch <ni...@alfresco.com> 2012-04-13 15:53:46 UTC ---
http://en.wikipedia.org/wiki/Floating_point

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 53076] cell.getNumericCellValue() returns incorrect results sometimes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53076

--- Comment #5 from Richard Ngo <rn...@tk20.com> 2012-04-15 02:42:15 UTC ---
have you tried using
http://poi.apache.org/apidocs/org/apache/poi/ss/util/NumberToTextConverter.html?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 53076] cell.getNumericCellValue() returns incorrect results sometimes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53076

--- Comment #3 from rohit.vats@gmail.com 2012-04-13 15:28:43 UTC ---
(In reply to comment #1)
> getNumericCellValue() returns the number stored in the file, which is a
> floating point. If you want a string that looks the same as excel shows, use
> something like DataFormatter to format your number

Ok, the actual value in the field seems to be -23530.915, which is why I
wondered why getNumericCellValue() returned -23530.915000000045.

Any thoughts?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 53076] cell.getNumericCellValue() returns incorrect results sometimes

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=53076

rohit.vats@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rohit.vats@gmail.com
         OS/Version|                            |All

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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