aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-10-18 22:40:14 +0000
committerPJ Fanning <fanningpj@apache.org>2021-10-18 22:40:14 +0000
commitd14dc1c659d82baae76fa92ba1e43cb169141580 (patch)
treeec4848a1e30b58c2fc00fd14cdb227483dd659d0 /poi
parent3c3154ea8c330833fc38bd2144018f09a7d56b09 (diff)
downloadpoi-d14dc1c659d82baae76fa92ba1e43cb169141580.tar.gz
poi-d14dc1c659d82baae76fa92ba1e43cb169141580.zip
scaling issue
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894366 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java b/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java
index 2da55efe90..3f37dc5553 100644
--- a/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java
+++ b/poi/src/main/java/org/apache/poi/ss/format/CellNumberFormatter.java
@@ -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 CellFormatter {
@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