We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

In aspose cell java giving wrong value on 15th digit of decimal

Hi ,
Currently i am using aspose cell java 20.1 version so my issue is mhen i am reading the values uploaded through excel using aspose using export array i am getting different values for eg:
In excel values is showing : 17485.1180423 where in aspose getting 17485.118042299997

can any help me with this how can i get exact what is present in excel


Thanks for providing us some details.

Please provide your template file and paste your sample code, we will check your issue soon.

PS. please zip the template file prior attaching.

Aspose_decimal_issue.zip (6.2 KB)

Hi Amjad_Sahi,

I have attached the excel file also find the below code snippet:

Workbook book = new Workbook(“Path of the excel file”);
Worksheet sheet=book.getWorksheets().get(0);
Cells cells = sheet.getCells();
Object[][] exportArray = cells.exportArray(0, 0, cells.getMaxDataRow()+1, cells.getMaxDataColumn()+1);

I have tried this scenario using latest version Aspose.Cells for Java 20.3.x but could not observe this issue. The values are fetched similar to the values shown by MS Excel. Please try this sample code with the latest version and share the feedback.

Hi ahsaniqbalsidiqui,

I have even tried with latest version of aspose cell java 20.3 and still the values are not matching please refer currently attached file also refer the below code snippet and output:

Workbook book=new Workbook(“filepath”);
Worksheet sheet= book.getWorksheets().get(0);
Cells cells=sheet.getCells();
Object[][] exportArray=cells.exportArray(0, 0, cells.getMaxDataRow()+1, cells.getMaxDataColumn()+1);
for(int i=0;i<exportArray.length;i++){
for(int j=0;j<exportArray[i].length;j++){
System.out.print(exportArray[i][j]+" ");

	} catch (Exception e) {
		// TODO: handle exception

0 5 0 3790.87 17485.118042299997
4 5.2 7.25 1034.8583333333331 5896
62.96209420153875 734.730555555555 214.25 705 11589.1180423
9.5 12.237569060773481 190.01353679323975 236.5 2.5
9 7.49171270718232 24.23646320676023 39 3
6.5 null 8.25 782.3638888888888 3.5
22 8.8 8.5 962.1477777777778 101.5
strong text

the bold number are not matching with excelAspose_decimal_issue.zip (6.2 KB)

We were able to observe the issue in Windows environment but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-43163 – Aspose.Cells giving different fraction value as compared to MS Excel

P.S. We tested the same issue in macOS, but no difference is observed when compared with values in MS Excel.

We have analyzed your issue and observed that the exported values are the original ones saved in the template file. MS Excel uses 15-digits for numeric values for display and most of other features, but for Java on Windows platform by default the digits is 17 for double to string. To get the same with what is shown in MS Excel, you need to truncate those values to 15-digits by yourself.

Hi ahsaniqbalsidiqui,

My Concern is why 17485.1180423 number which is less than 15 digits getting as 17485.118042299997
if i truncate this value to 15 digits it will give 17485.1180422999 which again doesn’t match with excel


“Truncate” just means decreasing the digits of the numeric values. In another words, you should round/set the value to 15 digits.

Hi Amjad_Sahi,

Actually there is not regularity in the numbers what i am getting in export
for eg :

  1. 17485.118042299997 if round it and get 15 digits ill get 17485.1180423 which is same as excel.

  2. 62.96209420153875 if i round it and get 15 digits i get 62.9620942015388 which doesn’t match with excel


Thanks for your feedback and details.

We will evaluate and get back to you soon.