Exemple #1
0
        public void TestFv()
        {
            double f, r, y, p, x;
            int    n;
            bool   t = false;

            r = 0; n = 3; y = 2; p = 7; t = true;
            f = FinanceLib.fv(r, n, y, p, t);
            x = -13;
            Assert.AreEqual(x, f, "fv ");

            r = 1; n = 10; y = 100; p = 10000; t = false;
            f = FinanceLib.fv(r, n, y, p, t);
            x = -10342300;
            Assert.AreEqual(x, f, "fv ");

            r = 1; n = 10; y = 100; p = 10000; t = true;
            f = FinanceLib.fv(r, n, y, p, t);
            x = -10444600;
            Assert.AreEqual(x, f, "fv ");

            r = 2; n = 12; y = 120; p = 12000; t = false;
            f = FinanceLib.fv(r, n, y, p, t);
            x = -6409178400d;
            Assert.AreEqual(x, f, "fv ");

            r = 2; n = 12; y = 120; p = 12000; t = true;
            f = FinanceLib.fv(r, n, y, p, t);
            x = -6472951200d;
            Assert.AreEqual(x, f, "fv ");

            // cross tests with pv
            r = 2.95; n = 13; y = 13000; p = -4406.78544294496; t = false;
            f = FinanceLib.fv(r, n, y, p, t);
            x = 333891.230010986; // as returned by excel
            Assert.AreEqual(x, f, 0.01);

            r = 2.95; n = 13; y = 13000; p = -17406.7852148156; t = true;
            f = FinanceLib.fv(r, n, y, p, t);
            x = 333891.230102539; // as returned by excel
            Assert.AreEqual(x, f, 0.01);
        }
Exemple #2
0
 public override double Evaluate(double rate, double arg1, double arg2, double arg3, bool type)
 {
     return(FinanceLib.fv(rate, arg1, arg2, arg3, type));
 }