public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { double result; try { double d0 = singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex); double d1 = singleOperandEvaluate(arg1, srcRowIndex, srcColumnIndex); result = evaluate(d0, d1); if (result == 0.0) { // this '==' matches +0.0 and -0.0 // Excel converts -0.0 to +0.0 for '*', '/', '%', '+' and '^' if (!(this instanceof SubtractEvalClass)) { return NumberEval.ZERO; } } if (Double.isNaN(result) || Double.isInfinite(result)) { return ErrorEval.NUM_ERROR; } } catch (EvaluationException e) { return e.getErrorEval(); } return new NumberEval(result); }
protected double[][] evaluate(double[][] d1, double[][] d2) throws IllegalArgumentException, EvaluationException { int width = (d1[0].length < d2[0].length) ? d1[0].length : d2[0].length; int height = (d1.length < d2.length) ? d1.length : d2.length; double result[][] = new double[height][width]; for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { result[j][i] = TwoOperandNumericOperation.this.evaluate(d1[j][i], d2[j][i]); } } return result; } }
protected double[][] evaluate(double[][] d1, double[][] d2) throws IllegalArgumentException, EvaluationException { int width = (d1[0].length < d2[0].length) ? d1[0].length : d2[0].length; int height = (d1.length < d2.length) ? d1.length : d2.length; double result[][] = new double[height][width]; for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { result[j][i] = TwoOperandNumericOperation.this.evaluate(d1[j][i], d2[j][i]); } } return result; } }
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { double result; try { double d0 = singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex); double d1 = singleOperandEvaluate(arg1, srcRowIndex, srcColumnIndex); result = evaluate(d0, d1); if (result == 0.0) { // this '==' matches +0.0 and -0.0 // Excel converts -0.0 to +0.0 for '*', '/', '%', '+' and '^' if (!(this instanceof SubtractEvalClass)) { return NumberEval.ZERO; } } if (Double.isNaN(result) || Double.isInfinite(result)) { return ErrorEval.NUM_ERROR; } } catch (EvaluationException e) { return e.getErrorEval(); } return new NumberEval(result); }
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { double result; try { double d0 = singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex); double d1 = singleOperandEvaluate(arg1, srcRowIndex, srcColumnIndex); result = evaluate(d0, d1); if (result == 0.0) { // this '==' matches +0.0 and -0.0 // Excel converts -0.0 to +0.0 for '*', '/', '%', '+' and '^' if (!(this instanceof SubtractEvalClass)) { return NumberEval.ZERO; } } if (Double.isNaN(result) || Double.isInfinite(result)) { return ErrorEval.NUM_ERROR; } } catch (EvaluationException e) { return e.getErrorEval(); } return new NumberEval(result); }
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) { double result; try { double d0 = singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex); double d1 = singleOperandEvaluate(arg1, srcRowIndex, srcColumnIndex); result = evaluate(d0, d1); if (result == 0.0) { // this '==' matches +0.0 and -0.0 // Excel converts -0.0 to +0.0 for '*', '/', '%', '+' and '^' if (!(this instanceof SubtractEvalClass)) { return NumberEval.ZERO; } } if (Double.isNaN(result) || Double.isInfinite(result)) { return ErrorEval.NUM_ERROR; } } catch (EvaluationException e) { return e.getErrorEval(); } return new NumberEval(result); }