xzel23 commented on code in PR #321:
URL: https://github.com/apache/poi/pull/321#discussion_r846661566
##########
poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java:
##########
@@ -950,7 +950,7 @@ private String getFormattedNumberString(Cell cell,
ConditionalFormattingEvaluato
if (numberFormat == null) {
return String.valueOf(d);
}
- String formatted = numberFormat.format(d);
+ String formatted = numberFormat.format(new
BigDecimal(String.valueOf(d)));
Review Comment:
Even if there was a problem with rounding, converting to BigDecimal would be
the wrong approach. 2.05 is simply not representable as a double, so converting
2.05f to BigDecimal can not suddenly increase accuracy. 2.05f is either > 2.05
or < 2.05 (the real number) - I cannot check since I am traveling without my
laptop.
You can submit s bug for this if POI formatting differs from Excel, but I'd
reject this fix. If something is wrong, the double rounding should be fixed
instead - converting to BigDecimal would introduce a huge performance penalty.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]