summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/d5/tengo/stdlib/math.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-04-06 22:18:25 +0200
committerGitHub <noreply@github.com>2019-04-06 22:18:25 +0200
commit115d20373c21b107a428a55247c64f900e116038 (patch)
treec7299b3d3be2a48c0f2d5bfbd856cbd1b27d2e55 /vendor/github.com/d5/tengo/stdlib/math.go
parentcdf33e5748c110e12097130bdb44637e3d14b229 (diff)
downloadmatterbridge-msglm-115d20373c21b107a428a55247c64f900e116038.tar.gz
matterbridge-msglm-115d20373c21b107a428a55247c64f900e116038.tar.bz2
matterbridge-msglm-115d20373c21b107a428a55247c64f900e116038.zip
Update tengo vendor and load the stdlib. Fixes #789 (#792)
Diffstat (limited to 'vendor/github.com/d5/tengo/stdlib/math.go')
-rw-r--r--vendor/github.com/d5/tengo/stdlib/math.go74
1 files changed, 74 insertions, 0 deletions
diff --git a/vendor/github.com/d5/tengo/stdlib/math.go b/vendor/github.com/d5/tengo/stdlib/math.go
new file mode 100644
index 00000000..08d82bdf
--- /dev/null
+++ b/vendor/github.com/d5/tengo/stdlib/math.go
@@ -0,0 +1,74 @@
+package stdlib
+
+import (
+ "math"
+
+ "github.com/d5/tengo/objects"
+)
+
+var mathModule = map[string]objects.Object{
+ "e": &objects.Float{Value: math.E},
+ "pi": &objects.Float{Value: math.Pi},
+ "phi": &objects.Float{Value: math.Phi},
+ "sqrt2": &objects.Float{Value: math.Sqrt2},
+ "sqrtE": &objects.Float{Value: math.SqrtE},
+ "sqrtPi": &objects.Float{Value: math.SqrtPi},
+ "sqrtPhi": &objects.Float{Value: math.SqrtPhi},
+ "ln2": &objects.Float{Value: math.Ln2},
+ "log2E": &objects.Float{Value: math.Log2E},
+ "ln10": &objects.Float{Value: math.Ln10},
+ "log10E": &objects.Float{Value: math.Log10E},
+ "abs": &objects.UserFunction{Name: "abs", Value: FuncAFRF(math.Abs)},
+ "acos": &objects.UserFunction{Name: "acos", Value: FuncAFRF(math.Acos)},
+ "acosh": &objects.UserFunction{Name: "acosh", Value: FuncAFRF(math.Acosh)},
+ "asin": &objects.UserFunction{Name: "asin", Value: FuncAFRF(math.Asin)},
+ "asinh": &objects.UserFunction{Name: "asinh", Value: FuncAFRF(math.Asinh)},
+ "atan": &objects.UserFunction{Name: "atan", Value: FuncAFRF(math.Atan)},
+ "atan2": &objects.UserFunction{Name: "atan2", Value: FuncAFFRF(math.Atan2)},
+ "atanh": &objects.UserFunction{Name: "atanh", Value: FuncAFRF(math.Atanh)},
+ "cbrt": &objects.UserFunction{Name: "cbrt", Value: FuncAFRF(math.Cbrt)},
+ "ceil": &objects.UserFunction{Name: "ceil", Value: FuncAFRF(math.Ceil)},
+ "copysign": &objects.UserFunction{Name: "copysign", Value: FuncAFFRF(math.Copysign)},
+ "cos": &objects.UserFunction{Name: "cos", Value: FuncAFRF(math.Cos)},
+ "cosh": &objects.UserFunction{Name: "cosh", Value: FuncAFRF(math.Cosh)},
+ "dim": &objects.UserFunction{Name: "dim", Value: FuncAFFRF(math.Dim)},
+ "erf": &objects.UserFunction{Name: "erf", Value: FuncAFRF(math.Erf)},
+ "erfc": &objects.UserFunction{Name: "erfc", Value: FuncAFRF(math.Erfc)},
+ "exp": &objects.UserFunction{Name: "exp", Value: FuncAFRF(math.Exp)},
+ "exp2": &objects.UserFunction{Name: "exp2", Value: FuncAFRF(math.Exp2)},
+ "expm1": &objects.UserFunction{Name: "expm1", Value: FuncAFRF(math.Expm1)},
+ "floor": &objects.UserFunction{Name: "floor", Value: FuncAFRF(math.Floor)},
+ "gamma": &objects.UserFunction{Name: "gamma", Value: FuncAFRF(math.Gamma)},
+ "hypot": &objects.UserFunction{Name: "hypot", Value: FuncAFFRF(math.Hypot)},
+ "ilogb": &objects.UserFunction{Name: "ilogb", Value: FuncAFRI(math.Ilogb)},
+ "inf": &objects.UserFunction{Name: "inf", Value: FuncAIRF(math.Inf)},
+ "is_inf": &objects.UserFunction{Name: "is_inf", Value: FuncAFIRB(math.IsInf)},
+ "is_nan": &objects.UserFunction{Name: "is_nan", Value: FuncAFRB(math.IsNaN)},
+ "j0": &objects.UserFunction{Name: "j0", Value: FuncAFRF(math.J0)},
+ "j1": &objects.UserFunction{Name: "j1", Value: FuncAFRF(math.J1)},
+ "jn": &objects.UserFunction{Name: "jn", Value: FuncAIFRF(math.Jn)},
+ "ldexp": &objects.UserFunction{Name: "ldexp", Value: FuncAFIRF(math.Ldexp)},
+ "log": &objects.UserFunction{Name: "log", Value: FuncAFRF(math.Log)},
+ "log10": &objects.UserFunction{Name: "log10", Value: FuncAFRF(math.Log10)},
+ "log1p": &objects.UserFunction{Name: "log1p", Value: FuncAFRF(math.Log1p)},
+ "log2": &objects.UserFunction{Name: "log2", Value: FuncAFRF(math.Log2)},
+ "logb": &objects.UserFunction{Name: "logb", Value: FuncAFRF(math.Logb)},
+ "max": &objects.UserFunction{Name: "max", Value: FuncAFFRF(math.Max)},
+ "min": &objects.UserFunction{Name: "min", Value: FuncAFFRF(math.Min)},
+ "mod": &objects.UserFunction{Name: "mod", Value: FuncAFFRF(math.Mod)},
+ "nan": &objects.UserFunction{Name: "nan", Value: FuncARF(math.NaN)},
+ "nextafter": &objects.UserFunction{Name: "nextafter", Value: FuncAFFRF(math.Nextafter)},
+ "pow": &objects.UserFunction{Name: "pow", Value: FuncAFFRF(math.Pow)},
+ "pow10": &objects.UserFunction{Name: "pow10", Value: FuncAIRF(math.Pow10)},
+ "remainder": &objects.UserFunction{Name: "remainder", Value: FuncAFFRF(math.Remainder)},
+ "signbit": &objects.UserFunction{Name: "signbit", Value: FuncAFRB(math.Signbit)},
+ "sin": &objects.UserFunction{Name: "sin", Value: FuncAFRF(math.Sin)},
+ "sinh": &objects.UserFunction{Name: "sinh", Value: FuncAFRF(math.Sinh)},
+ "sqrt": &objects.UserFunction{Name: "sqrt", Value: FuncAFRF(math.Sqrt)},
+ "tan": &objects.UserFunction{Name: "tan", Value: FuncAFRF(math.Tan)},
+ "tanh": &objects.UserFunction{Name: "tanh", Value: FuncAFRF(math.Tanh)},
+ "trunc": &objects.UserFunction{Name: "trunc", Value: FuncAFRF(math.Trunc)},
+ "y0": &objects.UserFunction{Name: "y0", Value: FuncAFRF(math.Y0)},
+ "y1": &objects.UserFunction{Name: "y1", Value: FuncAFRF(math.Y1)},
+ "yn": &objects.UserFunction{Name: "yn", Value: FuncAIFRF(math.Yn)},
+}