use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestRoundFuncs method assertRoundFuncEquals.
private static void assertRoundFuncEquals(Function func, double expected, double number, double places, double tolerance) {
ValueEval[] args = { new NumberEval(number), new NumberEval(places) };
NumberEval result = (NumberEval) func.evaluate(args, -1, (short) -1);
assertEquals(expected, result.getNumberValue(), tolerance);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestSlope method testBasic.
public void testBasic() {
Double exp = Math.pow(10, 7.5);
ValueEval[] yValues = { new NumberEval(3 + exp), new NumberEval(4 + exp), new NumberEval(2 + exp), new NumberEval(5 + exp), new NumberEval(4 + exp), new NumberEval(7 + exp) };
ValueEval areaEvalY = createAreaEval(yValues);
ValueEval[] xValues = { new NumberEval(1), new NumberEval(2), new NumberEval(3), new NumberEval(4), new NumberEval(5), new NumberEval(6) };
ValueEval areaEvalX = createAreaEval(xValues);
confirm(SLOPE, areaEvalX, areaEvalY, 0.7752808988764045);
// Excel 2010 gives 0.775280898876405
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestPoisson method testXZeroMeanZero.
public void testXZeroMeanZero() {
double x = 0;
double mean = 0;
// known result in excel
double result = 1;
NumberEval myResult = (NumberEval) invokePoisson(x, mean, true);
assertEquals(myResult.getNumberValue(), result, DELTA);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestPoisson method testCumulativeProbability.
public void testCumulativeProbability() {
double x = 1;
double mean = 0.2;
// known result
double result = 0.9824769036935787;
NumberEval myResult = (NumberEval) invokePoisson(x, mean, true);
assertEquals(myResult.getNumberValue(), result, DELTA);
}
use of org.apache.poi.ss.formula.eval.NumberEval in project poi by apache.
the class TestNper method testSimpleEvaluate.
@Test
public void testSimpleEvaluate() {
ValueEval[] args = { new NumberEval(0.05), new NumberEval(250), new NumberEval(-1000) };
ValueEval result = FinanceFunction.NPER.evaluate(args, 0, (short) 0);
assertEquals(NumberEval.class, result.getClass());
assertEquals(4.57353557, ((NumberEval) result).getNumberValue(), 0.00000001);
}
Aggregations