在GO
中评估数学公式,建议使用提供预先定义的功能和操作员的外部软件包。一个受欢迎的选项是政府:
安装goValuate:接口{},8) 参数[“ x”] = 8 result, err := expression.Evaluate(parameters)
In the above example:
NewEvaluableExpression: Creates an instance of EvaluableExpression that represents the formula.go get github.com/Knetic/govaluateparameters: A map that specifies the values to be used for the variables in the公式。
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3