]> source.dussan.org Git - poi.git/commitdiff
try to standardise div code
authorPJ Fanning <fanningpj@apache.org>
Sat, 9 Apr 2022 12:07:31 +0000 (12:07 +0000)
committerPJ Fanning <fanningpj@apache.org>
Sat, 9 Apr 2022 12:07:31 +0000 (12:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1899681 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java

index 4b8a3b8689e13fea37deb96d7ebee354f2f28da7..b14a058aff4d0beb4f4f2499cb74f8ff41136fc4 100644 (file)
@@ -803,7 +803,7 @@ public class DataFormatter {
                 if (obj instanceof BigDecimal) {
                     obj = ((BigDecimal) obj).divide(divider, RoundingMode.HALF_UP);
                 } else if (obj instanceof Double) {
-                    obj = (Double) obj / divider.doubleValue();
+                    obj = (new BigDecimal(NumberToTextConverter.toText((Double)obj))).divide(divider, RoundingMode.HALF_UP);
                 } else {
                     throw new UnsupportedOperationException();
                 }