aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-02-04 13:36:10 +0000
committerPJ Fanning <fanningpj@apache.org>2022-02-04 13:36:10 +0000
commit39b134acaed66f4f7136c20306850275662b26eb (patch)
treedd44822df278c0a949b7b65be0cc0bb99a082917 /poi
parentd5641b306216789559ed82da63a7832c708ff6d5 (diff)
downloadpoi-39b134acaed66f4f7136c20306850275662b26eb.tar.gz
poi-39b134acaed66f4f7136c20306850275662b26eb.zip
add besselj function
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897765 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java4
-rw-r--r--poi/src/test/java/org/apache/poi/ss/formula/functions/TestBesselJ.java1
2 files changed, 3 insertions, 2 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java
index 74b12db2f8..9da3e3bb4a 100644
--- a/poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java
+++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java
@@ -52,9 +52,9 @@ public final class BesselJ extends Fixed2ArgFunction implements FreeRefFunction
return ErrorEval.NUM_ERROR;
}
- org.apache.commons.math3.special.BesselJ bes = new org.apache.commons.math3.special.BesselJ(order);
+ final double result = org.apache.commons.math3.special.BesselJ.value(order, xval);
- return new NumberEval(bes.value(xval));
+ return new NumberEval(result);
} catch (EvaluationException e) {
return e.getErrorEval();
}
diff --git a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestBesselJ.java b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestBesselJ.java
index e3420503a8..cfe1f6ff7a 100644
--- a/poi/src/test/java/org/apache/poi/ss/formula/functions/TestBesselJ.java
+++ b/poi/src/test/java/org/apache/poi/ss/formula/functions/TestBesselJ.java
@@ -63,6 +63,7 @@ final class TestBesselJ {
double tolerance = 0.000001;
assertDouble(fe, cell, "BESSELJ(1.9, 2)", 0.329925829, tolerance);
assertDouble(fe, cell, "BESSELJ(1.9, 2.5)", 0.329925829, tolerance);
+ assertDouble(fe, cell, "BESSELJ(12.4,7)", -0.217156767, tolerance);
}
}