示例#1
0
文件: Npv.cs 项目: zanhaipeng/npoi
        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());
            }
        }
示例#2
0
文件: Fv.cs 项目: purehzj/npoi-1
 public override double Evaluate(double rate, double arg1, double arg2, double arg3, bool type)
 {
     return(FinanceLib.fv(rate, arg1, arg2, arg3, type));
 }