/// <summary> /// 内置函数 /// </summary> /// <param name="f"></param> /// <returns></returns> public static double callBuildIn(FnCall f) { Bifs funcType = f.FuncType; double v = eval(f.L); switch (funcType) { case Bifs.B_SQRT: return(Math.Sqrt(v)); case Bifs.B_EXP: return(Math.Exp(v)); case Bifs.B_LOG: return(Math.Log(v)); case Bifs.B_PRINT: System.Console.WriteLine("= {}", v); return(v); default: //yyerror("Unknown built-in function {}", funcType); return(0.0); } }
public FnCall(int type, AbstractAst l) { NodeType = 'F'; FuncType = (Bifs)type; L = l; }