I think adding OperandResolver.getSingleValue for the numerator and denominator might solvce the problem. @Override public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval venumerator, ValueEval vedenominator) { double enumerator = 0; try { ValueEval ve = OperandResolver.getSingleValue(venumerator, srcRowIndex, srcColumnIndex); // added this line enumerator = OperandResolver.coerceValueToDouble(ve); } catch (EvaluationException e) { return ErrorEval.VALUE_INVALID; } double denominator = 0; try { ValueEval ve = OperandResolver.getSingleValue(vedenominator, srcRowIndex, srcColumnIndex); // added this line denominator = OperandResolver.coerceValueToDouble(ve); } catch (EvaluationException e) { return ErrorEval.VALUE_INVALID; } if (denominator == 0) { return ErrorEval.DIV_ZERO; } return new NumberEval((int)(enumerator / denominator)); }
Do you have a code-sample that shows the problem? Ideally a self-standing unit-test? Would make it much easier to reproduce and ensure it stays fixed in the future.
(In reply to Dominik Stadler from comment #1) > Do you have a code-sample that shows the problem? Ideally a self-standing > unit-test? Would make it much easier to reproduce and ensure it stays fixed > in the future. I'm not at all familiar with your testing methods. What I did was load an Excel spreadsheet evaluate it and compare the results visually and with poi. I could write a simple Excel file and the POI unit test to show fail on the error. Is that OK?
That would be perfekt!
Any update on the sample file and unit-test?
Created attachment 36529 [details] Modifications to Quotient.java and QuotientFunctionTestCaseData.xls Add new line to 'QuotientFunctionTestCaseData.xls' to test QUOTIENT with cell references as arguments. Dereference Value before coercing it to double.
Created attachment 36530 [details] Edited Excel file: QuotientFunctionTestCaseData.xls Add new line to 'QuotientFunctionTestCaseData.xls' to test QUOTIENT with cell references as arguments.
Created attachment 36531 [details] Modifications to Quotient.java to support cell references Dereference Value before coercing it to double.
I did not know if the patch file was sufficient so I also added the excel and java files I edited.
fix applied with r1894103