简体   繁体   English

JExcel:在MS Excel中具有公式ROUNDUP的单元格上失去单元精度

[英]JExcel : Losing Cell Precison On Cells Having Formula ROUNDUP in MS Excel

I am unable to properly read numeric cells which has ROUNDUP in the formula, for example 我无法正确读取公式中具有ROUNDUP数字单元格,例如

Cell C25 is =ROUNDUP(5296.43899096,2) 单元格C25为=ROUNDUP(5296.43899096,2)

it shows 5296.44 in Excel but the below code 它在Excel中显示5296.44 ,但以下代码

    Cell cell = worksheet.getCell("C25");
    System.out.println( cell.getNumber() );

gives output as 5296.4400000000005 , please help 输出为5296.4400000000005 ,请帮助

You are probably reading the xml information. 您可能正在阅读xml信息。 And the issue has to do, in part, with the impossibility of representing certain decimal values in binary format, as well as with how MS stores the data. 这个问题部分与不可能以二进制格式表示某些十进制值以及MS如何存储数据有关。 See this Critique of Excel XML format 请参阅此对Excel XML格式的评论

The XML shows how information is stored. XML显示了信息的存储方式。 It does not directly show how information is displayed. 它不会直接显示信息的显示方式。 But it is interesting that 5296.44, as a direct entry, will be stored as 5296.44, but the result of the ROUND formula will be stored as 5296.4400000000005 但有趣的是,直接输入的5296.44将存储为5296.44,但是ROUND公式的结果将存储为5296.4400000000005

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM