예제 #1
0
        public void TestFactorial()
        {
            int    n = 0;
            double s = 0;

            n = 0;
            s = MathX.Factorial(n);
            AssertEquals("Factorial ", 1, s);

            n = 1;
            s = MathX.Factorial(n);
            AssertEquals("Factorial ", 1, s);

            n = 10;
            s = MathX.Factorial(n);
            AssertEquals("Factorial ", 3628800, s);

            n = 99;
            s = MathX.Factorial(n);
            AssertEquals("Factorial ", 9.33262154439E+155, s);

            n = -1;
            s = MathX.Factorial(n);
            AssertEquals("Factorial ", Double.NaN, s);

            n = Int32.MaxValue;
            s = MathX.Factorial(n);
            AssertEquals("Factorial ", Double.PositiveInfinity, s);
        }
예제 #2
0
파일: Fact.cs 프로젝트: xewn/Npoi.Core
 public override double Evaluate(double d)
 {
     return(MathX.Factorial((int)d));
 }