xzel23 commented on code in PR #321:
URL: https://github.com/apache/poi/pull/321#discussion_r847266740


##########
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:
   This is a terrible workaround and not a fix. 2.05f is less than 2.05, so 2.0 
would be the correct result when converting to a BigDecimal. The formatter 
should be fixed instead. Just check in JShell:
   ```
   axel@xiaolong ~ % jshell
   |  Welcome to JShell -- Version 18
   |  For an introduction type: /help intro
   
   jshell> 2.05
   $1 ==> 2.05
   
   jshell> new BigDecimal(2.05)
   $2 ==> 2.04999999999999982236431605997495353221893310546875
   ```



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

Reply via email to