-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions.go
57 lines (45 loc) · 1.24 KB
/
functions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package govaluate
import (
"github.com/tiezhong2004/govaluate/in_functions"
)
var FlowFunctions map[string]ExpressionFunction = map[string]ExpressionFunction{
"isDefined": in_functions.IsDefined,
"ifnull": in_functions.IfNull,
"if": in_functions.If,
}
var MathFunctions map[string]ExpressionFunction = map[string]ExpressionFunction{
"cos": in_functions.Cos,
"acos": in_functions.Acos,
"cosh": in_functions.Cosh,
"acosh": in_functions.Acosh,
"exp": in_functions.Exp,
"exp2": in_functions.Exp2,
"log": in_functions.Log,
"log10": in_functions.Log10,
"round": in_functions.Round,
"floor": in_functions.Floor,
"ceil": in_functions.Ceil,
"trunc": in_functions.Trunc,
"sin": in_functions.Sin,
"asin": in_functions.Asin,
"sinh": in_functions.Sinh,
"asinh": in_functions.Asinh,
"sqrt": in_functions.Sqrt,
"tan": in_functions.Tan,
"atan": in_functions.Atan,
"atan2": in_functions.Atan2,
"tanh": in_functions.Tanh,
"atanh": in_functions.Atanh,
"max": in_functions.Max,
"min": in_functions.Min,
}
var Functions map[string]ExpressionFunction
func init() {
Functions = make(map[string]ExpressionFunction)
for k, v := range MathFunctions {
Functions[k] = v
}
for k, v := range FlowFunctions {
Functions[k] = v
}
}