public static void DbFunctions_EXP() { DbFunctionTools tools = new DbFunctionTools(); Random rnd = new Random(); //Double. { Console.WriteLine("Testing DbFunctions.EXP(Double)..."); double input = rnd.NextDouble(); if (input < 0.5) { input = input * -1d; } List <DbValue> args = new List <DbValue>(); args.Add(tools.AllocValue(input)); DbFunctionArguments fargs = new DbFunctionArguments(args); DbValue valOutput = DbFunctions.EXP(tools, fargs); ByteSlice bs = valOutput.Eval(); double output = tools.GetDouble(bs); double expected = Math.Exp(input); if (expected != output) { throw new Exception("DbFunctions.EXP(Double) has failed. Expected result: " + expected.ToString() + ", but received: " + output.ToString()); } else { Console.WriteLine("Expected results received."); } } { Console.WriteLine("Testing DbFunctions.EXP(Int32)..."); int input = rnd.Next(Int32.MinValue, Int32.MaxValue); List <DbValue> args = new List <DbValue>(); args.Add(tools.AllocValue(input)); DbFunctionArguments fargs = new DbFunctionArguments(args); DbValue valOutput = DbFunctions.EXP(tools, fargs); ByteSlice bs = valOutput.Eval(); double output = tools.GetDouble(bs); double expected = Math.Exp((double)input); if (expected != output) { throw new Exception("DbFunctions.EXP(Int32) has failed. Expected result: " + expected.ToString() + ", but received: " + output.ToString()); } else { Console.WriteLine("Expected results received."); } } { Console.WriteLine("Testing DbFunctions.EXP(Long)..."); long input = DateTime.Now.Ticks; List <DbValue> args = new List <DbValue>(); args.Add(tools.AllocValue(input)); DbFunctionArguments fargs = new DbFunctionArguments(args); DbValue valOutput = DbFunctions.EXP(tools, fargs); ByteSlice bs = valOutput.Eval(); double output = tools.GetDouble(bs); double expected = Math.Exp((long)input); if (expected != output) { throw new Exception("DbFunctions.EXP(Long) has failed. Expected result: " + expected.ToString() + ", but received: " + output.ToString()); } else { Console.WriteLine("Expected results received."); } } }