func RegFunction(name string, argc int, fun func(...ExprAST) float64) error {
	if len(name) == 0 {
		return errors.New("RegFunction name is not empty")
	}
	if argc < -1 {
		return errors.New("RegFunction argc should be -1, 0, or a positive integer")
	}
	if _, ok := defFunc[name]; ok {
		return errors.New("RegFunction name is already exist")
	}
	defFunc[name] = defS{argc, fun}
	return nil
}
RegFunction is Top level function
register a new function to use in expressions
name: be register function name. the same function name only needs to be registered once.
argc: this is a number of parameter signatures. should be -1, 0, or a positive integer
-1 variable-length argument; >=0 fixed numbers argument
fun:  function handler
package engine
import (
	"errors"
	"fmt"
	"math"
	"math/big"
	"strconv"
	"strings"
)
func ParseAndExec(s string) (r float64, err error) {
	toks, err := Parse(s)
	if err != nil {
		return 0, err
	}
	ast := NewAST(toks, s)
	if ast.Err != nil {
		return 0, ast.Err
	}
	ar := ast.ParseExpression()
	if ast.Err != nil {
		return 0, ast.Err
	}
	defer func() {
		if e := recover(); e != nil {
			err = e.(error)
		}
	}()
	return ExprASTResult(ar), err
}
func ErrPos(s string, pos int) string {
	r := strings.Repeat("-", len(s)) + "\n"
	s += "\n"
	for i := 0; i < pos; i++ {
		s += " "
	}
	s += "^\n"
	return r + s + r
}
func Pow(x float64, n float64) float64 {
	return math.Pow(x, n)
}
func expr2Radian(expr ExprAST) float64 {
	r := ExprASTResult(expr)
	if TrigonometricMode == AngleMode {
		r = r / 180 * math.Pi
	}
	return r
}
func Float64ToStr(f float64) string {
	return strconv.FormatFloat(f, 'f', -1, 64)
}