From d7cebf71cb2fc73e6f6be77ce6efd0de178aaa80 Mon Sep 17 00:00:00 2001 From: Arash Partow Date: Mon, 30 Dec 2013 21:09:57 +1100 Subject: [PATCH] C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html --- Makefile | 2 +- exprtk.hpp | 4 +--- exprtk_benchmark.cpp | 2 +- exprtk_simple_example_01.cpp | 2 +- exprtk_simple_example_02.cpp | 2 +- exprtk_simple_example_03.cpp | 2 +- exprtk_simple_example_04.cpp | 2 +- exprtk_simple_example_05.cpp | 2 +- exprtk_simple_example_06.cpp | 2 +- exprtk_simple_example_07.cpp | 2 +- exprtk_simple_example_08.cpp | 2 +- exprtk_simple_example_09.cpp | 2 +- exprtk_simple_example_10.cpp | 2 +- exprtk_test.cpp | 23 +++++++++++------------ readme.txt | 10 +++++----- 15 files changed, 29 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 71c85d0..92c1410 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # ************************************************************** # * C++ Mathematical Expression Toolkit Library * # * * -# * Author: Arash Partow (1999-2013) * +# * Author: Arash Partow (1999-2014) * # * URL: http://www.partow.net/programming/exprtk/index.html * # * * # * Copyright notice: * diff --git a/exprtk.hpp b/exprtk.hpp index 0ed6722..694cf64 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -2,7 +2,7 @@ ****************************************************************** * C++ Mathematical Expression Toolkit Library * * * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * @@ -9949,8 +9949,6 @@ namespace exprtk typedef details::T0oT1oT2oT3_define covovoc_t; typedef details::T0oT1oT2oT3_define vococov_t; - struct range_pack; - public: enum precompilation_step diff --git a/exprtk_benchmark.cpp b/exprtk_benchmark.cpp index 109f70b..cb3df48 100644 --- a/exprtk_benchmark.cpp +++ b/exprtk_benchmark.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * ExprTk vs Native Benchmarks * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_01.cpp b/exprtk_simple_example_01.cpp index 700d902..33d4c5d 100644 --- a/exprtk_simple_example_01.cpp +++ b/exprtk_simple_example_01.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 1 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_02.cpp b/exprtk_simple_example_02.cpp index d6b2958..6594e9e 100644 --- a/exprtk_simple_example_02.cpp +++ b/exprtk_simple_example_02.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 2 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_03.cpp b/exprtk_simple_example_03.cpp index 4dd612d..3c7cbba 100644 --- a/exprtk_simple_example_03.cpp +++ b/exprtk_simple_example_03.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 3 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_04.cpp b/exprtk_simple_example_04.cpp index 011d868..fc45d94 100644 --- a/exprtk_simple_example_04.cpp +++ b/exprtk_simple_example_04.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 4 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_05.cpp b/exprtk_simple_example_05.cpp index 45de3d4..d1aa086 100644 --- a/exprtk_simple_example_05.cpp +++ b/exprtk_simple_example_05.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 5 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_06.cpp b/exprtk_simple_example_06.cpp index b771d25..c9dfb0a 100644 --- a/exprtk_simple_example_06.cpp +++ b/exprtk_simple_example_06.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 6 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_07.cpp b/exprtk_simple_example_07.cpp index fd80643..9fd8366 100644 --- a/exprtk_simple_example_07.cpp +++ b/exprtk_simple_example_07.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 7 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_08.cpp b/exprtk_simple_example_08.cpp index 6436263..1956e5c 100644 --- a/exprtk_simple_example_08.cpp +++ b/exprtk_simple_example_08.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 8 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_09.cpp b/exprtk_simple_example_09.cpp index 7b3fce2..5654d46 100644 --- a/exprtk_simple_example_09.cpp +++ b/exprtk_simple_example_09.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 9 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_simple_example_10.cpp b/exprtk_simple_example_10.cpp index 7643eb0..93c92cc 100644 --- a/exprtk_simple_example_10.cpp +++ b/exprtk_simple_example_10.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Simple Example 10 * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * diff --git a/exprtk_test.cpp b/exprtk_test.cpp index 04ccfe3..4365a01 100644 --- a/exprtk_test.cpp +++ b/exprtk_test.cpp @@ -3,7 +3,7 @@ * C++ Mathematical Expression Toolkit Library * * * * Examples and Unit-Tests * - * Author: Arash Partow (1999-2013) * + * Author: Arash Partow (1999-2014) * * URL: http://www.partow.net/programming/exprtk/index.html * * * * Copyright notice: * @@ -3658,7 +3658,6 @@ inline bool run_test19() typedef exprtk::symbol_table symbol_table_t; typedef exprtk::expression expression_t; typedef exprtk::parser parser_t; - typedef exprtk::parser_error::type error_t; typedef exprtk::function_compositor compositor_t; typedef typename compositor_t::function function_t; @@ -3685,7 +3684,7 @@ inline bool run_test19() // gof(x) = g(f(x)) compositor.add("gof","g(f(x))","x"); - exprtk::symbol_table& symbol_table = compositor.symbol_table(); + symbol_table_t& symbol_table = compositor.symbol_table(); symbol_table.add_constants(); symbol_table.add_variable("x",x); @@ -3707,7 +3706,7 @@ inline bool run_test19() expression_t expression; expression.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; if (!parser.compile(expr_str_list[i],expression)) { @@ -3782,7 +3781,7 @@ inline bool run_test19() .var("x").var("y").var("z") .var("w").var("u").var("v")); - exprtk::symbol_table& symbol_table = compositor.symbol_table(); + symbol_table_t& symbol_table = compositor.symbol_table(); symbol_table.add_constants(); symbol_table.add_variable("x",x); symbol_table.add_variable("y",y); @@ -3794,7 +3793,7 @@ inline bool run_test19() expression_t expression; expression.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; std::string expression_str = "f6(x,y,z,w,u,v) + 2"; @@ -3878,7 +3877,7 @@ inline bool run_test19() "} ", "x"); - exprtk::symbol_table& symbol_table = compositor.symbol_table(); + symbol_table_t& symbol_table = compositor.symbol_table(); symbol_table.add_constants(); symbol_table.add_variable("x",x); @@ -3893,7 +3892,7 @@ inline bool run_test19() expression2.register_symbol_table(symbol_table); expression3.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; if (!parser.compile(expression_str1,expression1)) { @@ -4041,7 +4040,7 @@ inline bool run_test19() "fibonacci_impl4(x,0,1,0)", "x"); - exprtk::symbol_table& symbol_table = compositor.symbol_table(); + symbol_table_t& symbol_table = compositor.symbol_table(); symbol_table.add_constants(); symbol_table.add_variable("x",x); @@ -4059,7 +4058,7 @@ inline bool run_test19() expression3.register_symbol_table(symbol_table); expression4.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; if (!parser.compile(expression_str1,expression1)) { @@ -4162,7 +4161,7 @@ inline bool run_test19() { T x = T(0); - exprtk::symbol_table symbol_table; + symbol_table_t symbol_table; symbol_table.add_constants(); symbol_table.add_variable("x",x); @@ -4199,7 +4198,7 @@ inline bool run_test19() expression.register_symbol_table(symbol_table); - exprtk::parser parser; + parser_t parser; if (!parser.compile(expression_str,expression)) { diff --git a/readme.txt b/readme.txt index 41e7a23..2a51d19 100644 --- a/readme.txt +++ b/readme.txt @@ -557,12 +557,12 @@ correctly optimize such expressions for a given architecture. (18) Recursive calls made from within composited functions will have a stack size bound by the stack of the executing architecture. - (19) The following are examples of floating point value represenations - that are supported: + (19) The following are examples of compliant floating point value + representations: (a) 12345 (b) -123.456 (c) +123.456e+12 (d) 123.456E-12 - (c) +012.045e+07 (e) .1234 - (f) 123.456f (f) -321.654E+3L + (e) +012.045e+07 (f) .1234 + (g) 123.456f (h) -321.654E+3L (20) Expressions may contain any of the following comment styles: 1. // .... \n @@ -583,7 +583,7 @@ struct myfunc : public exprtk::ifunction { myfunc() : exprtk::ifunction(2) {} - inline T operator()(const T& v1, const T& v2) + T operator()(const T& v1, const T& v2) { return T(1) + (v1 * v2) / T(3); }