No description
Find a file
2020-02-13 23:00:59 +03:00
.vscode initial commit 2020-02-13 22:55:13 +03:00
examples initial commit 2020-02-13 22:55:13 +03:00
.codecov.yml initial commit 2020-02-13 22:55:13 +03:00
.travis.yml initial commit 2020-02-13 22:55:13 +03:00
calculator.go initial commit 2020-02-13 22:55:13 +03:00
calculator_test.go initial commit 2020-02-13 22:55:13 +03:00
checklicense.sh initial commit 2020-02-13 22:55:13 +03:00
defaults.go initial commit 2020-02-13 22:55:13 +03:00
doc.go initial commit 2020-02-13 22:55:13 +03:00
function.go initial commit 2020-02-13 22:55:13 +03:00
go.mod initial commit 2020-02-13 22:55:13 +03:00
LICENSE initial commit 2020-02-13 22:55:13 +03:00
operator.go initial commit 2020-02-13 22:55:13 +03:00
README.md Update README.md 2020-02-13 23:00:59 +03:00
tokenizer.go initial commit 2020-02-13 22:55:13 +03:00
tokenizer_test.go initial commit 2020-02-13 22:55:13 +03:00
types.go initial commit 2020-02-13 22:55:13 +03:00

GoMathExecutor

[![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov]

Package GoMathExecutor provides simple expression executor.

Installation

go get github.com/neonxp/GoMathExecutor

Usage

calc := executor.NewCalc()
calc.AddOperators(executor.MathOperators) // Loads default MathOperators (see: defaults.go)
calc.Prepare("2+2*2") // Prepare expression
calc.Execute(nil) // == 6, nil
calc.Prepare("x * (y+z)") // Prepare another expression with variables
calc.Execute(map[string]float64{
	"x": 3,
	"y": 2,
	"z": 1,
}) // == 9, nil