123456789101112131415161718 |
- package services
- import (
- "github.com/dengsgo/math-engine/engine"
- "math"
- )
- func init() {
- engine.RegFunction("log", 2, func(expr ...engine.ExprAST) float64 {
- base := math.Log(engine.ExprASTResult(expr[0]))
- number := math.Log(engine.ExprASTResult(expr[1]))
- return number / base
- })
- engine.RegFunction("ln", 1, func(expr ...engine.ExprAST) float64 {
- return math.Log(engine.ExprASTResult(expr[0]))
- })
- }
|