Beispiel #1
0
        public ValueEval Evaluate(ValueEval[] args, int srcRowIndex, int srcColumnIndex)
        {
            int nArgs = args.Length;

            if (nArgs < 2)
            {
                return(ErrorEval.VALUE_INVALID);
            }

            try
            {
                double rate = NumericFunction.SingleOperandEvaluate(args[0], srcRowIndex, srcColumnIndex);
                // convert tail arguments into an array of doubles
                ValueEval[] vargs = new ValueEval[args.Length - 1];
                Array.Copy(args, 1, vargs, 0, vargs.Length);
                double[] values = AggregateFunction.ValueCollector.CollectValues(vargs);

                double result = FinanceLib.npv(rate, values);
                NumericFunction.CheckValue(result);
                return(new NumberEval(result));
            }
            catch (EvaluationException e)
            {
                return(e.GetErrorEval());
            }
        }
Beispiel #2
0
 public override double Evaluate(double rate, double arg1, double arg2, double arg3, bool type)
 {
     return(FinanceLib.pmt(rate, arg1, arg2, arg3, type));
 }