mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-21 10:32:35 +01:00
234 lines
4.8 KiB
Go
234 lines
4.8 KiB
Go
package stdlib
|
|
|
|
import (
|
|
"math"
|
|
|
|
"github.com/d5/tengo/v2"
|
|
)
|
|
|
|
var mathModule = map[string]tengo.Object{
|
|
"e": &tengo.Float{Value: math.E},
|
|
"pi": &tengo.Float{Value: math.Pi},
|
|
"phi": &tengo.Float{Value: math.Phi},
|
|
"sqrt2": &tengo.Float{Value: math.Sqrt2},
|
|
"sqrtE": &tengo.Float{Value: math.SqrtE},
|
|
"sqrtPi": &tengo.Float{Value: math.SqrtPi},
|
|
"sqrtPhi": &tengo.Float{Value: math.SqrtPhi},
|
|
"ln2": &tengo.Float{Value: math.Ln2},
|
|
"log2E": &tengo.Float{Value: math.Log2E},
|
|
"ln10": &tengo.Float{Value: math.Ln10},
|
|
"log10E": &tengo.Float{Value: math.Log10E},
|
|
"abs": &tengo.UserFunction{
|
|
Name: "abs",
|
|
Value: FuncAFRF(math.Abs),
|
|
},
|
|
"acos": &tengo.UserFunction{
|
|
Name: "acos",
|
|
Value: FuncAFRF(math.Acos),
|
|
},
|
|
"acosh": &tengo.UserFunction{
|
|
Name: "acosh",
|
|
Value: FuncAFRF(math.Acosh),
|
|
},
|
|
"asin": &tengo.UserFunction{
|
|
Name: "asin",
|
|
Value: FuncAFRF(math.Asin),
|
|
},
|
|
"asinh": &tengo.UserFunction{
|
|
Name: "asinh",
|
|
Value: FuncAFRF(math.Asinh),
|
|
},
|
|
"atan": &tengo.UserFunction{
|
|
Name: "atan",
|
|
Value: FuncAFRF(math.Atan),
|
|
},
|
|
"atan2": &tengo.UserFunction{
|
|
Name: "atan2",
|
|
Value: FuncAFFRF(math.Atan2),
|
|
},
|
|
"atanh": &tengo.UserFunction{
|
|
Name: "atanh",
|
|
Value: FuncAFRF(math.Atanh),
|
|
},
|
|
"cbrt": &tengo.UserFunction{
|
|
Name: "cbrt",
|
|
Value: FuncAFRF(math.Cbrt),
|
|
},
|
|
"ceil": &tengo.UserFunction{
|
|
Name: "ceil",
|
|
Value: FuncAFRF(math.Ceil),
|
|
},
|
|
"copysign": &tengo.UserFunction{
|
|
Name: "copysign",
|
|
Value: FuncAFFRF(math.Copysign),
|
|
},
|
|
"cos": &tengo.UserFunction{
|
|
Name: "cos",
|
|
Value: FuncAFRF(math.Cos),
|
|
},
|
|
"cosh": &tengo.UserFunction{
|
|
Name: "cosh",
|
|
Value: FuncAFRF(math.Cosh),
|
|
},
|
|
"dim": &tengo.UserFunction{
|
|
Name: "dim",
|
|
Value: FuncAFFRF(math.Dim),
|
|
},
|
|
"erf": &tengo.UserFunction{
|
|
Name: "erf",
|
|
Value: FuncAFRF(math.Erf),
|
|
},
|
|
"erfc": &tengo.UserFunction{
|
|
Name: "erfc",
|
|
Value: FuncAFRF(math.Erfc),
|
|
},
|
|
"exp": &tengo.UserFunction{
|
|
Name: "exp",
|
|
Value: FuncAFRF(math.Exp),
|
|
},
|
|
"exp2": &tengo.UserFunction{
|
|
Name: "exp2",
|
|
Value: FuncAFRF(math.Exp2),
|
|
},
|
|
"expm1": &tengo.UserFunction{
|
|
Name: "expm1",
|
|
Value: FuncAFRF(math.Expm1),
|
|
},
|
|
"floor": &tengo.UserFunction{
|
|
Name: "floor",
|
|
Value: FuncAFRF(math.Floor),
|
|
},
|
|
"gamma": &tengo.UserFunction{
|
|
Name: "gamma",
|
|
Value: FuncAFRF(math.Gamma),
|
|
},
|
|
"hypot": &tengo.UserFunction{
|
|
Name: "hypot",
|
|
Value: FuncAFFRF(math.Hypot),
|
|
},
|
|
"ilogb": &tengo.UserFunction{
|
|
Name: "ilogb",
|
|
Value: FuncAFRI(math.Ilogb),
|
|
},
|
|
"inf": &tengo.UserFunction{
|
|
Name: "inf",
|
|
Value: FuncAIRF(math.Inf),
|
|
},
|
|
"is_inf": &tengo.UserFunction{
|
|
Name: "is_inf",
|
|
Value: FuncAFIRB(math.IsInf),
|
|
},
|
|
"is_nan": &tengo.UserFunction{
|
|
Name: "is_nan",
|
|
Value: FuncAFRB(math.IsNaN),
|
|
},
|
|
"j0": &tengo.UserFunction{
|
|
Name: "j0",
|
|
Value: FuncAFRF(math.J0),
|
|
},
|
|
"j1": &tengo.UserFunction{
|
|
Name: "j1",
|
|
Value: FuncAFRF(math.J1),
|
|
},
|
|
"jn": &tengo.UserFunction{
|
|
Name: "jn",
|
|
Value: FuncAIFRF(math.Jn),
|
|
},
|
|
"ldexp": &tengo.UserFunction{
|
|
Name: "ldexp",
|
|
Value: FuncAFIRF(math.Ldexp),
|
|
},
|
|
"log": &tengo.UserFunction{
|
|
Name: "log",
|
|
Value: FuncAFRF(math.Log),
|
|
},
|
|
"log10": &tengo.UserFunction{
|
|
Name: "log10",
|
|
Value: FuncAFRF(math.Log10),
|
|
},
|
|
"log1p": &tengo.UserFunction{
|
|
Name: "log1p",
|
|
Value: FuncAFRF(math.Log1p),
|
|
},
|
|
"log2": &tengo.UserFunction{
|
|
Name: "log2",
|
|
Value: FuncAFRF(math.Log2),
|
|
},
|
|
"logb": &tengo.UserFunction{
|
|
Name: "logb",
|
|
Value: FuncAFRF(math.Logb),
|
|
},
|
|
"max": &tengo.UserFunction{
|
|
Name: "max",
|
|
Value: FuncAFFRF(math.Max),
|
|
},
|
|
"min": &tengo.UserFunction{
|
|
Name: "min",
|
|
Value: FuncAFFRF(math.Min),
|
|
},
|
|
"mod": &tengo.UserFunction{
|
|
Name: "mod",
|
|
Value: FuncAFFRF(math.Mod),
|
|
},
|
|
"nan": &tengo.UserFunction{
|
|
Name: "nan",
|
|
Value: FuncARF(math.NaN),
|
|
},
|
|
"nextafter": &tengo.UserFunction{
|
|
Name: "nextafter",
|
|
Value: FuncAFFRF(math.Nextafter),
|
|
},
|
|
"pow": &tengo.UserFunction{
|
|
Name: "pow",
|
|
Value: FuncAFFRF(math.Pow),
|
|
},
|
|
"pow10": &tengo.UserFunction{
|
|
Name: "pow10",
|
|
Value: FuncAIRF(math.Pow10),
|
|
},
|
|
"remainder": &tengo.UserFunction{
|
|
Name: "remainder",
|
|
Value: FuncAFFRF(math.Remainder),
|
|
},
|
|
"signbit": &tengo.UserFunction{
|
|
Name: "signbit",
|
|
Value: FuncAFRB(math.Signbit),
|
|
},
|
|
"sin": &tengo.UserFunction{
|
|
Name: "sin",
|
|
Value: FuncAFRF(math.Sin),
|
|
},
|
|
"sinh": &tengo.UserFunction{
|
|
Name: "sinh",
|
|
Value: FuncAFRF(math.Sinh),
|
|
},
|
|
"sqrt": &tengo.UserFunction{
|
|
Name: "sqrt",
|
|
Value: FuncAFRF(math.Sqrt),
|
|
},
|
|
"tan": &tengo.UserFunction{
|
|
Name: "tan",
|
|
Value: FuncAFRF(math.Tan),
|
|
},
|
|
"tanh": &tengo.UserFunction{
|
|
Name: "tanh",
|
|
Value: FuncAFRF(math.Tanh),
|
|
},
|
|
"trunc": &tengo.UserFunction{
|
|
Name: "trunc",
|
|
Value: FuncAFRF(math.Trunc),
|
|
},
|
|
"y0": &tengo.UserFunction{
|
|
Name: "y0",
|
|
Value: FuncAFRF(math.Y0),
|
|
},
|
|
"y1": &tengo.UserFunction{
|
|
Name: "y1",
|
|
Value: FuncAFRF(math.Y1),
|
|
},
|
|
"yn": &tengo.UserFunction{
|
|
Name: "yn",
|
|
Value: FuncAIFRF(math.Yn),
|
|
},
|
|
}
|