forked from alfredxing/calc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.go
45 lines (41 loc) · 872 Bytes
/
log.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
package functions
import (
"math"
)
import (
"github.com/alfredxing/calc/operators"
)
var (
log = &operators.Operator{
Name: "log",
Precedence: 0,
Associativity: operators.L,
Args: 1,
Operation: func (args []float64) float64 {
return math.Log10(args[0])
},
}
ln = &operators.Operator{
Name: "ln",
Precedence: 0,
Associativity: operators.L,
Args: 1,
Operation: func (args []float64) float64 {
return math.Log(args[0])
},
}
lg = &operators.Operator{
Name: "lg",
Precedence: 0,
Associativity: operators.L,
Args: 1,
Operation: func (args []float64) float64 {
return math.Log2(args[0])
},
}
)
func init() {
Register(log)
Register(ln)
Register(lg)
}