Esempio n. 1
0
 private Instance NewMathType()
 {
     // math nao tem prototype
     var math = new Instance();
     math.SetField("PI", new Instance(Math.PI));
     math.SetMethod("sqrt", (s, a) => new Instance(Math.Sqrt((double)a[0].Scalar)));
     math.SetMethod("cos", (s, a) => new Instance(Math.Cos((double)a[0].Scalar)));
     math.SetMethod("sin", (s, a) => new Instance(Math.Sin((double)a[0].Scalar)));
     math.SetMethod("abs", (s, a) => new Instance(Math.Abs((double)a[0].Scalar)));
     math.SetMethod("round", (s, a) => new Instance(Math.Round((double)a[0].Scalar)));
     math.SetMethod("max", (s, a) => new Instance(Math.Max(a[0].Scalar, a[1].Scalar)));
     return math;
 }