]> source.dussan.org Git - poi.git/commitdiff
add besselj function
authorPJ Fanning <fanningpj@apache.org>
Fri, 4 Feb 2022 13:36:10 +0000 (13:36 +0000)
committerPJ Fanning <fanningpj@apache.org>
Fri, 4 Feb 2022 13:36:10 +0000 (13:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897765 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/ss/formula/functions/BesselJ.java
poi/src/test/java/org/apache/poi/ss/formula/functions/TestBesselJ.java

index 74b12db2f898b708d3951360dfb518acbe2d98e5..9da3e3bb4a298229b85e0cca8e4e4b5d23343e24 100644 (file)
@@ -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();
         }
index e3420503a89552b92361114ec8e072be02f1fda2..cfe1f6ff7a026738802089950278e02c9e981962 100644 (file)
@@ -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);
         }
     }