You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/10/18 22:40:14 UTC

svn commit: r1894366 - in /poi/trunk: poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java

Author: fanningpj
Date: Mon Oct 18 22:40:14 2021
New Revision: 1894366

URL: http://svn.apache.org/viewvc?rev=1894366&view=rev
Log:
scaling issue

Modified:
    poi/trunk/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java
    poi/trunk/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java

Modified: poi/trunk/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java?rev=1894366&r1=1894365&r2=1894366&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java (original)
+++ poi/trunk/poi-ooxml/src/test/java/org/apache/poi/ss/tests/format/TestCellFormatPart.java Mon Oct 18 22:40:14 2021
@@ -46,11 +46,11 @@ import org.junit.jupiter.api.Test;
 /**
  * Class for spreadsheet-based tests, such as are used for cell formatting.
  * This reads tests from the spreadsheet, as well as reading
- * flags that can be used to paramterize these tests.
+ * flags that can be used to parameterize these tests.
  * <p>
  * Each test has four parts: The expected result (column A), the format string
  * (column B), the value to format (column C), and a comma-separated list of
- * categores that this test falls in. Normally all tests are run, but if the
+ * categories that this test falls in. Normally all tests are run, but if the
  * flag "Categories" is not empty, only tests that have at least one category
  * listed in "Categories" are run.
  */

Modified: poi/trunk/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java?rev=1894366&r1=1894365&r2=1894366&view=diff
==============================================================================
--- poi/trunk/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java (original)
+++ poi/trunk/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java Mon Oct 18 22:40:14 2021
@@ -16,6 +16,7 @@
 ==================================================================== */
 package org.apache.poi.ss.format;
 
+import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.text.FieldPosition;
@@ -424,8 +425,8 @@ public class CellNumberFormatter extends
 
     @Override
     public void formatValue(StringBuffer toAppendTo, Object valueObject) {
-        double value = ((Number) valueObject).doubleValue();
-        value *= scale;
+        BigDecimal bd = BigDecimal.valueOf(((Number) valueObject).doubleValue()).multiply(BigDecimal.valueOf(scale));
+        double value = bd.doubleValue();
 
         // For negative numbers:
         // - If the cell format has a negative number format, this method



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org