Beispiel #1
0
        private static void TestSin(Double a)
        {
            String di = System.Math.Sin(a).ToString();
            String ni = BigMath.Sin(BigNum.Create(a)).ToString();

            Console.WriteLine("Sin({0,6}) = {1,6} : {2,6} -> {3,6}", a, di, ni, di == ni ? "Pass" : "Fail");
        }
Beispiel #2
0
        private static BigNum EvaluateFunction(Function function, BigNum num)
        {
            switch (function)
            {
            case Function.Sin: return(BigMath.Sin(num));

            case Function.Cos: return(BigMath.Cos(num));

            case Function.Tan: return(BigMath.Tan(num));

            case Function.Csc: return(BigMath.Csc(num));

            case Function.Sec: return(BigMath.Sec(num));

            case Function.Cot: return(BigMath.Cot(num));

            case Function.Abs:   return(BigMath.Abs(num));

            case Function.Ceil:  return(BigMath.Ceiling(num));

            case Function.Floor: return(BigMath.Floor(num));

            case Function.Fact:  return(BigMath.Gamma(num));

            default:
                throw new ExpressionException("Unknown or invalid function");
            }
        }