Skip to content

mathematical-expression-cpp-dll

Compare
Choose a tag to compare
@BeardedManZhao BeardedManZhao released this 02 Dec 12:30
· 13 commits to main since this release
f39dcb5

DLL Download

File List


Include.zip

The Header file directory of the library. You can unzip the directory and import it into your project, so that your project can support the library.

mathematical_expression_cpp_WINx64.dll

The source code of this library is a DLL dynamic library file that has been successfully compiled in the Win64 environment. You can directly link this file to your project.


include.zip

该库头文件目录,您可以将此目录解压后导入到您的项目中,使得您的项目能够支持该库。

mathematical_expression_cpp_WINx64.dll

该库源码在 win64 环境下编译成功的dll动态库文件,您可以直接将此文件链接到您的项目中。

#3 1.0.2版本更新

image 数学表达式-cpp 更新日志

更新版本:1.0.1 -> 1.0.2

  • 更新版本: 1.0.1 -> 1.0.2
  • 更新时间: 2023年12月2日
  • 参与更新任务的作者列表
名称 GitHub主页 联系方式
BeardedManZhao https://github.com/BeardedManZhao [email protected]
------ ------ ------

注意事项

1.0.2 版本中 针对函数的注册操作不能向后兼容,如果是在1.0.2版本以以后的版本 请使用下面的方式注册函数

    // 准备函数 将函数的形参类型 由 double* 更改为 ME::MEStack<double> 即可 因为 ME::MEStack<double> 具有更大的灵活性
auto myFun =[](const ME::MEStack<double>& v) {
double res = 0;
for (int i = 0; i < v.size(); ++i){
res += v.get(i);
}
return res;
};
// 注册函数 将我们的函数注册成为 DoubleValue 的名称
ME::FunctionManager::append("sum", myFun);

更新日志

  • 新增多参函数表达式计算组件,函数形参可以是多个参数
#include <mathematical_expression.h>
#include "FunctionManager.h"
int main() {
    system("chcp 65001");
    // 准备函数 这里的函数的作用是将 3 个参数求和
    auto myFun = [](const ME::MEStack<double>& v) {
        double res = 0;
        for (int i = 0; i < v.size(); ++i){
            res += v.get(i);
        }
        return res;
    };
    // 注册函数 将我们的函数注册成为 DoubleValue 的名称
    ME::FunctionManager::append("sum", myFun);
    // 构建一个数学表达式,表达式中使用到了函数 DoubleValue
    string s = "2 * sum(2 + 3, 1 + 20, 10 + (1 - 2)) + 1";
    // 获取到 数学表达式解析库
    mathematical_expression me;
    // 获取到函数表达式计算组件
    auto functionFormulaCalculation = me.getFunctionFormulaCalculation2();
    // 检查数学表达式
    functionFormulaCalculation.check(s);
    // 计算出结果
    ME::CalculationNumberResults results = functionFormulaCalculation << s;
    // 将结果打印出来
    cout << "计算层数:" << results.getResultLayers() << "\t计算结果:" << results << "\t计算来源:" << results.getCalculationSourceName() << endl;
}