You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by GitBox <gi...@apache.org> on 2022/04/07 11:13:52 UTC
[GitHub] [poi] pjfanning commented on a diff in pull request #321: Fix rounding problems
pjfanning commented on code in PR #321:
URL: https://github.com/apache/poi/pull/321#discussion_r845011704
##########
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:
Converting a double to a string and then to a bigdecimal and then to a formatted string - this seems dangerous to me - each conversion introducing more risk of rounding issues.
--
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: dev-unsubscribe@poi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org