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/26 10:05:45 UTC

[Bug 56317] New: While reading the numeric value "0.002877" and its multipe of 2 & 4 and division of 3 it shows 19 decimals.

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

            Bug ID: 56317
           Summary: While reading the numeric value "0.002877" and its
                    multipe of 2 & 4 and division of 3 it shows 19
                    decimals.
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: kbenny@techmahindra.com

The following apache packages used;

--------------
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.hssf.usermodel.*;
import org.apache.log4j.*;
--------------

int lengthBeforeDecimal = decimalVal.substring(0,decimalPos).length();
                                //System.out.println("lengthh before
decimal:::"+lengthBeforeDecimal);
                                //System.out.println("Length after
decimal:::"+(actualLength-lengthBeforeDecimal-1));        
                               
lengthAfterDec=actualLength-lengthBeforeDecimal-1;

The above code is getting 19 decimals for the numeric value: "0.002877" and its
multiples of 2 & 4(0.005754, 0.011508) and division by 3(0.000959).

i.e.; for example: "0.002877" is taken as ".0028770000000000002".

Could you please suggest so that only the six decimals are to be read from the
xl-sheet.

Thanks & Regards,
Benny J. Kelambeth

-- 
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 56317] While reading excel (.xls) numeric value "0.002877" and its multipes of 2 & 4 and division of 3 it shows 19 decimals insted of 6.

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

Nick Burch <ap...@gagravarr.org> changed:

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

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
That's just how floating point values work

If you want to format a cell as a string, as it looks in Excel, use
DataFormatter.formatCellValue(Cell)

-- 
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 56317] While reading excel (.xls) numeric value "0.002877" and its multipes of 2 & 4 and division of 3 it shows 19 decimals insted of 6.

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

--- Comment #2 from Benny Kelambeth <kb...@techmahindra.com> ---
Hi,
The issue is that only few of the excel (.xls file) numeric value like:
"0.002877", is reading as 19 decimals; how ever if we change the last decimal
value like 0.002876 or 0.002878 then it is returning as 6 decimals only.

How can we  read the following values as 6 decimals.
0.002877
0.005754
0.011508
0.000959
...........

Thanks,
Benny

-- 
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 56317] While reading excel (.xls) numeric value "0.002877" and its multipes of 2 & 4 and division of 3 it shows 19 decimals insted of 6.

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

Benny Kelambeth <kb...@techmahindra.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|While reading the numeric   |While reading excel (.xls)
                   |value "0.002877" and its    |numeric value "0.002877"
                   |multipe of 2 & 4 and        |and its multipes of 2 & 4
                   |division of 3 it shows 19   |and division of 3 it shows
                   |decimals.                   |19 decimals insted of 6.

-- 
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