From e3d51a3222fcd5a874403429439ced3df6614019 Mon Sep 17 00:00:00 2001 From: Arash Partow Date: Sun, 19 Jan 2014 17:31:34 +1100 Subject: [PATCH] C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html --- exprtk.hpp | 514 ++++++++++++++++++++++++++++-------------------- exprtk_test.cpp | 445 +++++++++++++++++++++++------------------ 2 files changed, 550 insertions(+), 409 deletions(-) diff --git a/exprtk.hpp b/exprtk.hpp index 2d65ac5..488bd79 100644 --- a/exprtk.hpp +++ b/exprtk.hpp @@ -3051,8 +3051,8 @@ namespace exprtk e_sf84 = 1084, e_sf85 = 1085, e_sf86 = 1086, e_sf87 = 1087, e_sf88 = 1088, e_sf89 = 1089, e_sf90 = 1090, e_sf91 = 1091, e_sf92 = 1092, e_sf93 = 1093, e_sf94 = 1094, e_sf95 = 1095, - e_sf96 = 1096, e_sf97 = 1097, e_sf98 = 1098, - e_sffinal = 1099, + e_sf96 = 1096, e_sf97 = 1097, e_sf98 = 1098, e_sf99 = 1099, + e_sffinal = 1100, e_sf4ext00 = 2000, e_sf4ext01 = 2001, e_sf4ext02 = 2002, e_sf4ext03 = 2003, e_sf4ext04 = 2004, e_sf4ext05 = 2005, e_sf4ext06 = 2006, e_sf4ext07 = 2007, e_sf4ext08 = 2008, e_sf4ext09 = 2009, e_sf4ext10 = 2010, e_sf4ext11 = 2011, @@ -4504,101 +4504,102 @@ namespace exprtk template struct sf01_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x + y) * z; } static inline std::string id() { return "(t+t)*t";} }; template struct sf02_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x + y) - z; } static inline std::string id() { return "(t+t)-t";} }; template struct sf03_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x + y) + z; } static inline std::string id() { return "(t+t)+t";} }; - template struct sf04_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x - y) / z; } static inline std::string id() { return "(t-t)/t";} }; - template struct sf05_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x - y) * z; } static inline std::string id() { return "(t-t)*t";} }; - template struct sf06_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x * y) + z; } static inline std::string id() { return "(t*t)+t";} }; - template struct sf07_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x * y) - z; } static inline std::string id() { return "(t*t)-t";} }; - template struct sf08_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x * y) / z; } static inline std::string id() { return "(t*t)/t";} }; - template struct sf09_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x * y) * z; } static inline std::string id() { return "(t*t)*t";} }; - template struct sf10_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x / y) + z; } static inline std::string id() { return "(t/t)+t";} }; - template struct sf11_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x / y) - z; } static inline std::string id() { return "(t/t)-t";} }; - template struct sf12_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x / y) / z; } static inline std::string id() { return "(t/t)/t";} }; - template struct sf13_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x / y) * z; } static inline std::string id() { return "(t/t)*t";} }; - template struct sf14_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x / (y + z); } static inline std::string id() { return "t/(t+t)";} }; - template struct sf15_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x / (y - z); } static inline std::string id() { return "t/(t-t)";} }; - template struct sf16_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x / (y * z); } static inline std::string id() { return "t/(t*t)";} }; - template struct sf17_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x / (y / z); } static inline std::string id() { return "t/(t/t)";} }; - template struct sf18_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * (y + z); } static inline std::string id() { return "t*(t+t)";} }; - template struct sf19_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * (y - z); } static inline std::string id() { return "t*(t-t)";} }; - template struct sf20_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * (y * z); } static inline std::string id() { return "t*(t*t)";} }; - template struct sf21_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * (y / z); } static inline std::string id() { return "t*(t/t)";} }; - template struct sf22_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x - (y + z); } static inline std::string id() { return "t-(t+t)";} }; - template struct sf23_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x - (y - z); } static inline std::string id() { return "t-(t-t)";} }; - template struct sf24_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x - (y / z); } static inline std::string id() { return "t-(t/t)";} }; - template struct sf25_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x - (y * z); } static inline std::string id() { return "t-(t*t)";} }; - template struct sf26_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x + (y * z); } static inline std::string id() { return "t+(t*t)";} }; - template struct sf27_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x + (y / z); } static inline std::string id() { return "t+(t/t)";} }; - template struct sf28_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x + (y + z); } static inline std::string id() { return "t+(t+t)";} }; - template struct sf29_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x + (y - z); } static inline std::string id() { return "t+(t-t)";} }; - template struct sf30_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^2 + z - template struct sf31_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^3 + z - template struct sf32_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^4 + z - template struct sf33_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^5 + z - template struct sf34_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^6 + z - template struct sf35_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^7 + z - template struct sf36_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^8 + z - template struct sf37_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^9 + z - template struct sf38_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::log(y) + z; } }; - template struct sf39_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::log(y) - z; } }; - template struct sf40_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::log10(y) + z; } }; - template struct sf41_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::log10(y) - z; } }; - template struct sf42_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::sin(y) + z; } }; - template struct sf43_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::sin(y) - z; } }; - template struct sf44_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::cos(y) + z; } }; - template struct sf45_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::cos(y) - z; } }; - template struct sf46_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return is_true(x) ? y : z; } }; - template struct sf47_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y + z) / w); } static inline std::string id() { return "t+((t+t)/t)";} }; - template struct sf48_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y + z) * w); } static inline std::string id() { return "t+((t+t)*t)";} }; - template struct sf49_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y - z) / w); } static inline std::string id() { return "t+((t-t)/t)";} }; - template struct sf50_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y - z) * w); } static inline std::string id() { return "t+((t-t)*t)";} }; - template struct sf51_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y * z) / w); } static inline std::string id() { return "t+((t*t)/t)";} }; - template struct sf52_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y * z) * w); } static inline std::string id() { return "t+((t*t)*t)";} }; - template struct sf53_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y / z) + w); } static inline std::string id() { return "t+((t/t)+t)";} }; - template struct sf54_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y / z) / w); } static inline std::string id() { return "t+((t/t)/t)";} }; - template struct sf55_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y / z) * w); } static inline std::string id() { return "t+((t/t)*t)";} }; - template struct sf56_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y + z) / w); } static inline std::string id() { return "t-((t+t)/t)";} }; - template struct sf57_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y + z) * w); } static inline std::string id() { return "t-((t+t)*t)";} }; - template struct sf58_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y - z) / w); } static inline std::string id() { return "t-((t-t)/t)";} }; - template struct sf59_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y - z) * w); } static inline std::string id() { return "t-((t-t)*t)";} }; - template struct sf60_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y * z) / w); } static inline std::string id() { return "t-((t*t)/t)";} }; - template struct sf61_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y * z) * w); } static inline std::string id() { return "t-((t*t)*t)";} }; - template struct sf62_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y / z) / w); } static inline std::string id() { return "t-((t/t)/t)";} }; - template struct sf63_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y / z) * w); } static inline std::string id() { return "t-((t/t)*t)";} }; - template struct sf64_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x + y) * z) - w; } static inline std::string id() { return "((t+t)*t)-t";} }; - template struct sf65_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x - y) * z) - w; } static inline std::string id() { return "((t-t)*t)-t";} }; - template struct sf66_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x * y) * z) - w; } static inline std::string id() { return "((t*t)*t)-t";} }; - template struct sf67_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x / y) * z) - w; } static inline std::string id() { return "((t/t)*t)-t";} }; - template struct sf68_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x + y) / z) - w; } static inline std::string id() { return "((t+t)/t)-t";} }; - template struct sf69_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x - y) / z) - w; } static inline std::string id() { return "((t-t)/t)-t";} }; - template struct sf70_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x * y) / z) - w; } static inline std::string id() { return "((t*t)/t)-t";} }; - template struct sf71_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x / y) / z) - w; } static inline std::string id() { return "((t/t)/t)-t";} }; - template struct sf72_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x * y) + (z * w); } static inline std::string id() { return "(t*t)+(t*t)";} }; - template struct sf73_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x * y) - (z * w); } static inline std::string id() { return "(t*t)-(t*t)";} }; - template struct sf74_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x * y) + (z / w); } static inline std::string id() { return "(t*t)+(t/t)";} }; - template struct sf75_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x * y) - (z / w); } static inline std::string id() { return "(t*t)-(t/t)";} }; - template struct sf76_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x / y) + (z / w); } static inline std::string id() { return "(t/t)+(t/t)";} }; - template struct sf77_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x / y) - (z / w); } static inline std::string id() { return "(t/t)-(t/t)";} }; - template struct sf78_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x / y) - (z * w); } static inline std::string id() { return "(t/t)-(t*t)";} }; - template struct sf79_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x / (y + (z * w)); } static inline std::string id() { return "t/(t+(t*t))";} }; - template struct sf80_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x / (y - (z * w)); } static inline std::string id() { return "t/(t-(t*t))";} }; - template struct sf81_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x * (y + (z * w)); } static inline std::string id() { return "t*(t+(t*t))";} }; - template struct sf82_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x * (y - (z * w)); } static inline std::string id() { return "t*(t-(t*t))";} }; - template struct sf83_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^2+z*w^2 - template struct sf84_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^3+z*w^3 - template struct sf85_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^4+z*w^4 - template struct sf86_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^5+z*w^5 - template struct sf87_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^6+z*w^6 - template struct sf88_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^7+z*w^7 - template struct sf89_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^8+z*w^8 - template struct sf90_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^9+z*w^9 - template struct sf91_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (is_true(x) && is_true(y)) ? z : w; } }; - template struct sf92_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (is_true(x) || is_true(y)) ? z : w; } }; - template struct sf93_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x < y) ? z : w; } }; - template struct sf94_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x <= y) ? z : w; } }; - template struct sf95_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x > y) ? z : w; } }; - template struct sf96_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x >= y) ? z : w; } }; - template struct sf97_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return numeric::equal(x,y) ? z : w; } }; - template struct sf98_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x * numeric::sin(y) + z * numeric::cos(w); } }; + template struct sf04_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x - y) + z; } static inline std::string id() { return "(t-t)+t";} }; + template struct sf05_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x - y) / z; } static inline std::string id() { return "(t-t)/t";} }; + template struct sf06_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x - y) * z; } static inline std::string id() { return "(t-t)*t";} }; + template struct sf07_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x * y) + z; } static inline std::string id() { return "(t*t)+t";} }; + template struct sf08_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x * y) - z; } static inline std::string id() { return "(t*t)-t";} }; + template struct sf09_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x * y) / z; } static inline std::string id() { return "(t*t)/t";} }; + template struct sf10_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x * y) * z; } static inline std::string id() { return "(t*t)*t";} }; + template struct sf11_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x / y) + z; } static inline std::string id() { return "(t/t)+t";} }; + template struct sf12_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x / y) - z; } static inline std::string id() { return "(t/t)-t";} }; + template struct sf13_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x / y) / z; } static inline std::string id() { return "(t/t)/t";} }; + template struct sf14_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return (x / y) * z; } static inline std::string id() { return "(t/t)*t";} }; + template struct sf15_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x / (y + z); } static inline std::string id() { return "t/(t+t)";} }; + template struct sf16_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x / (y - z); } static inline std::string id() { return "t/(t-t)";} }; + template struct sf17_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x / (y * z); } static inline std::string id() { return "t/(t*t)";} }; + template struct sf18_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x / (y / z); } static inline std::string id() { return "t/(t/t)";} }; + template struct sf19_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * (y + z); } static inline std::string id() { return "t*(t+t)";} }; + template struct sf20_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * (y - z); } static inline std::string id() { return "t*(t-t)";} }; + template struct sf21_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * (y * z); } static inline std::string id() { return "t*(t*t)";} }; + template struct sf22_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * (y / z); } static inline std::string id() { return "t*(t/t)";} }; + template struct sf23_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x - (y + z); } static inline std::string id() { return "t-(t+t)";} }; + template struct sf24_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x - (y - z); } static inline std::string id() { return "t-(t-t)";} }; + template struct sf25_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x - (y / z); } static inline std::string id() { return "t-(t/t)";} }; + template struct sf26_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x - (y * z); } static inline std::string id() { return "t-(t*t)";} }; + template struct sf27_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x + (y * z); } static inline std::string id() { return "t+(t*t)";} }; + template struct sf28_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x + (y / z); } static inline std::string id() { return "t+(t/t)";} }; + template struct sf29_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x + (y + z); } static inline std::string id() { return "t+(t+t)";} }; + template struct sf30_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x + (y - z); } static inline std::string id() { return "t+(t-t)";} }; + template struct sf31_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^2 + z + template struct sf32_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^3 + z + template struct sf33_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^4 + z + template struct sf34_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^5 + z + template struct sf35_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^6 + z + template struct sf36_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^7 + z + template struct sf37_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^8 + z + template struct sf38_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return axnb(x,y,z); } }; //x * y^9 + z + template struct sf39_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::log(y) + z; } }; + template struct sf40_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::log(y) - z; } }; + template struct sf41_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::log10(y) + z; } }; + template struct sf42_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::log10(y) - z; } }; + template struct sf43_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::sin(y) + z; } }; + template struct sf44_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::sin(y) - z; } }; + template struct sf45_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::cos(y) + z; } }; + template struct sf46_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return x * numeric::cos(y) - z; } }; + template struct sf47_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z) { return is_true(x) ? y : z; } }; + template struct sf48_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y + z) / w); } static inline std::string id() { return "t+((t+t)/t)";} }; + template struct sf49_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y + z) * w); } static inline std::string id() { return "t+((t+t)*t)";} }; + template struct sf50_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y - z) / w); } static inline std::string id() { return "t+((t-t)/t)";} }; + template struct sf51_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y - z) * w); } static inline std::string id() { return "t+((t-t)*t)";} }; + template struct sf52_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y * z) / w); } static inline std::string id() { return "t+((t*t)/t)";} }; + template struct sf53_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y * z) * w); } static inline std::string id() { return "t+((t*t)*t)";} }; + template struct sf54_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y / z) + w); } static inline std::string id() { return "t+((t/t)+t)";} }; + template struct sf55_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y / z) / w); } static inline std::string id() { return "t+((t/t)/t)";} }; + template struct sf56_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x + ((y / z) * w); } static inline std::string id() { return "t+((t/t)*t)";} }; + template struct sf57_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y + z) / w); } static inline std::string id() { return "t-((t+t)/t)";} }; + template struct sf58_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y + z) * w); } static inline std::string id() { return "t-((t+t)*t)";} }; + template struct sf59_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y - z) / w); } static inline std::string id() { return "t-((t-t)/t)";} }; + template struct sf60_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y - z) * w); } static inline std::string id() { return "t-((t-t)*t)";} }; + template struct sf61_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y * z) / w); } static inline std::string id() { return "t-((t*t)/t)";} }; + template struct sf62_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y * z) * w); } static inline std::string id() { return "t-((t*t)*t)";} }; + template struct sf63_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y / z) / w); } static inline std::string id() { return "t-((t/t)/t)";} }; + template struct sf64_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x - ((y / z) * w); } static inline std::string id() { return "t-((t/t)*t)";} }; + template struct sf65_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x + y) * z) - w; } static inline std::string id() { return "((t+t)*t)-t";} }; + template struct sf66_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x - y) * z) - w; } static inline std::string id() { return "((t-t)*t)-t";} }; + template struct sf67_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x * y) * z) - w; } static inline std::string id() { return "((t*t)*t)-t";} }; + template struct sf68_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x / y) * z) - w; } static inline std::string id() { return "((t/t)*t)-t";} }; + template struct sf69_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x + y) / z) - w; } static inline std::string id() { return "((t+t)/t)-t";} }; + template struct sf70_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x - y) / z) - w; } static inline std::string id() { return "((t-t)/t)-t";} }; + template struct sf71_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x * y) / z) - w; } static inline std::string id() { return "((t*t)/t)-t";} }; + template struct sf72_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return ((x / y) / z) - w; } static inline std::string id() { return "((t/t)/t)-t";} }; + template struct sf73_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x * y) + (z * w); } static inline std::string id() { return "(t*t)+(t*t)";} }; + template struct sf74_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x * y) - (z * w); } static inline std::string id() { return "(t*t)-(t*t)";} }; + template struct sf75_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x * y) + (z / w); } static inline std::string id() { return "(t*t)+(t/t)";} }; + template struct sf76_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x * y) - (z / w); } static inline std::string id() { return "(t*t)-(t/t)";} }; + template struct sf77_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x / y) + (z / w); } static inline std::string id() { return "(t/t)+(t/t)";} }; + template struct sf78_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x / y) - (z / w); } static inline std::string id() { return "(t/t)-(t/t)";} }; + template struct sf79_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x / y) - (z * w); } static inline std::string id() { return "(t/t)-(t*t)";} }; + template struct sf80_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x / (y + (z * w)); } static inline std::string id() { return "t/(t+(t*t))";} }; + template struct sf81_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x / (y - (z * w)); } static inline std::string id() { return "t/(t-(t*t))";} }; + template struct sf82_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x * (y + (z * w)); } static inline std::string id() { return "t*(t+(t*t))";} }; + template struct sf83_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x * (y - (z * w)); } static inline std::string id() { return "t*(t-(t*t))";} }; + template struct sf84_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^2+z*w^2 + template struct sf85_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^3+z*w^3 + template struct sf86_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^4+z*w^4 + template struct sf87_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^5+z*w^5 + template struct sf88_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^6+z*w^6 + template struct sf89_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^7+z*w^7 + template struct sf90_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^8+z*w^8 + template struct sf91_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return axn(x,y) + axn(z,w); } }; //x*y^9+z*w^9 + template struct sf92_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (is_true(x) && is_true(y)) ? z : w; } }; + template struct sf93_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (is_true(x) || is_true(y)) ? z : w; } }; + template struct sf94_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x < y) ? z : w; } }; + template struct sf95_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x <= y) ? z : w; } }; + template struct sf96_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x > y) ? z : w; } }; + template struct sf97_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x >= y) ? z : w; } }; + template struct sf98_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return numeric::equal(x,y) ? z : w; } }; + template struct sf99_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return x * numeric::sin(y) + z * numeric::cos(w); } }; template struct sfext00_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x + y) - (z * w); } static inline std::string id() { return "(t+t)-(t*t)";} }; template struct sfext01_op : public sf_base { typedef typename sf_base::Type Type; static inline T process(Type x, Type y, Type z, Type w) { return (x + y) - (z / w); } static inline std::string id() { return "(t+t)-(t/t)";} }; @@ -12035,7 +12036,7 @@ namespace exprtk return error_node(); } - const std::size_t sf_3_to_4 = details::e_sf47; + const std::size_t sf_3_to_4 = details::e_sf48; const details::operator_type opt_type = details::operator_type(id + 1000); const std::size_t NumberOfParameters = (id < (sf_3_to_4 - 1000)) ? 3 : 4; @@ -12536,7 +12537,7 @@ namespace exprtk (details::e_frac == operation) || (details::e_trunc == operation); } - inline bool sf3_optimizable(const std::string sf3id, trinary_functor_t& tfunc) + inline bool sf3_optimizable(const std::string& sf3id, trinary_functor_t& tfunc) { typename sf3_map_t::iterator itr = sf3_map_->find(sf3id); if (sf3_map_->end() == itr) @@ -12546,7 +12547,7 @@ namespace exprtk return true; } - inline bool sf4_optimizable(const std::string sf4id, quaternary_functor_t& qfunc) + inline bool sf4_optimizable(const std::string& sf4id, quaternary_functor_t& qfunc) { typename sf4_map_t::iterator itr = sf4_map_->find(sf4id); if (sf4_map_->end() == itr) @@ -12556,7 +12557,7 @@ namespace exprtk return true; } - inline bool sf3_optimizable(const std::string sf3id, details::operator_type& operation) + inline bool sf3_optimizable(const std::string& sf3id, details::operator_type& operation) { typename sf3_map_t::iterator itr = sf3_map_->find(sf3id); if (sf3_map_->end() == itr) @@ -12566,7 +12567,7 @@ namespace exprtk return true; } - inline bool sf4_optimizable(const std::string sf4id, details::operator_type& operation) + inline bool sf4_optimizable(const std::string& sf4id, details::operator_type& operation) { typename sf4_map_t::iterator itr = sf4_map_->find(sf4id); if (sf4_map_->end() == itr) @@ -13213,7 +13214,7 @@ namespace exprtk case_stmt(details::e_sf40,details::sf40_op) case_stmt(details::e_sf41,details::sf41_op) case_stmt(details::e_sf42,details::sf42_op) case_stmt(details::e_sf43,details::sf43_op) case_stmt(details::e_sf44,details::sf44_op) case_stmt(details::e_sf45,details::sf45_op) - case_stmt(details::e_sf46,details::sf46_op) + case_stmt(details::e_sf46,details::sf46_op) case_stmt(details::e_sf47,details::sf47_op) #undef case_stmt default : return error_node(); } @@ -13261,7 +13262,7 @@ namespace exprtk case_stmt(details::e_sf40,details::sf40_op) case_stmt(details::e_sf41,details::sf41_op) case_stmt(details::e_sf42,details::sf42_op) case_stmt(details::e_sf43,details::sf43_op) case_stmt(details::e_sf44,details::sf44_op) case_stmt(details::e_sf45,details::sf45_op) - case_stmt(details::e_sf46,details::sf46_op) + case_stmt(details::e_sf46,details::sf46_op) case_stmt(details::e_sf47,details::sf47_op) #undef case_stmt default : return error_node(); } @@ -13306,7 +13307,7 @@ namespace exprtk case_stmt(details::e_sf40,details::sf40_op) case_stmt(details::e_sf41,details::sf41_op) case_stmt(details::e_sf42,details::sf42_op) case_stmt(details::e_sf43,details::sf43_op) case_stmt(details::e_sf44,details::sf44_op) case_stmt(details::e_sf45,details::sf45_op) - case_stmt(details::e_sf46,details::sf46_op) + case_stmt(details::e_sf46,details::sf46_op) case_stmt(details::e_sf47,details::sf47_op) #undef case_stmt default : return error_node(); } @@ -13323,32 +13324,32 @@ namespace exprtk allocate > >(operation,branch); \ break; \ - case_stmt(details::e_sf47,details::sf47_op) case_stmt(details::e_sf48,details::sf48_op) - case_stmt(details::e_sf49,details::sf49_op) case_stmt(details::e_sf50,details::sf50_op) - case_stmt(details::e_sf51,details::sf51_op) case_stmt(details::e_sf52,details::sf52_op) - case_stmt(details::e_sf53,details::sf53_op) case_stmt(details::e_sf54,details::sf54_op) - case_stmt(details::e_sf55,details::sf55_op) case_stmt(details::e_sf56,details::sf56_op) - case_stmt(details::e_sf57,details::sf57_op) case_stmt(details::e_sf58,details::sf58_op) - case_stmt(details::e_sf59,details::sf59_op) case_stmt(details::e_sf60,details::sf60_op) - case_stmt(details::e_sf61,details::sf61_op) case_stmt(details::e_sf62,details::sf62_op) - case_stmt(details::e_sf63,details::sf63_op) case_stmt(details::e_sf64,details::sf64_op) - case_stmt(details::e_sf65,details::sf65_op) case_stmt(details::e_sf66,details::sf66_op) - case_stmt(details::e_sf67,details::sf67_op) case_stmt(details::e_sf68,details::sf68_op) - case_stmt(details::e_sf69,details::sf69_op) case_stmt(details::e_sf70,details::sf70_op) - case_stmt(details::e_sf71,details::sf71_op) case_stmt(details::e_sf72,details::sf72_op) - case_stmt(details::e_sf73,details::sf73_op) case_stmt(details::e_sf74,details::sf74_op) - case_stmt(details::e_sf75,details::sf75_op) case_stmt(details::e_sf76,details::sf76_op) - case_stmt(details::e_sf77,details::sf77_op) case_stmt(details::e_sf78,details::sf78_op) - case_stmt(details::e_sf79,details::sf79_op) case_stmt(details::e_sf80,details::sf80_op) - case_stmt(details::e_sf81,details::sf81_op) case_stmt(details::e_sf82,details::sf82_op) - case_stmt(details::e_sf83,details::sf83_op) case_stmt(details::e_sf84,details::sf84_op) - case_stmt(details::e_sf85,details::sf85_op) case_stmt(details::e_sf86,details::sf86_op) - case_stmt(details::e_sf87,details::sf87_op) case_stmt(details::e_sf88,details::sf88_op) - case_stmt(details::e_sf89,details::sf89_op) case_stmt(details::e_sf90,details::sf90_op) - case_stmt(details::e_sf91,details::sf91_op) case_stmt(details::e_sf92,details::sf92_op) - case_stmt(details::e_sf93,details::sf93_op) case_stmt(details::e_sf94,details::sf94_op) - case_stmt(details::e_sf95,details::sf95_op) case_stmt(details::e_sf96,details::sf96_op) - case_stmt(details::e_sf97,details::sf97_op) case_stmt(details::e_sf98,details::sf98_op) + case_stmt(details::e_sf48,details::sf48_op) case_stmt(details::e_sf49,details::sf49_op) + case_stmt(details::e_sf50,details::sf50_op) case_stmt(details::e_sf51,details::sf51_op) + case_stmt(details::e_sf52,details::sf52_op) case_stmt(details::e_sf53,details::sf53_op) + case_stmt(details::e_sf54,details::sf54_op) case_stmt(details::e_sf55,details::sf55_op) + case_stmt(details::e_sf56,details::sf56_op) case_stmt(details::e_sf57,details::sf57_op) + case_stmt(details::e_sf58,details::sf58_op) case_stmt(details::e_sf59,details::sf59_op) + case_stmt(details::e_sf60,details::sf60_op) case_stmt(details::e_sf61,details::sf61_op) + case_stmt(details::e_sf62,details::sf62_op) case_stmt(details::e_sf63,details::sf63_op) + case_stmt(details::e_sf64,details::sf64_op) case_stmt(details::e_sf65,details::sf65_op) + case_stmt(details::e_sf66,details::sf66_op) case_stmt(details::e_sf67,details::sf67_op) + case_stmt(details::e_sf68,details::sf68_op) case_stmt(details::e_sf69,details::sf69_op) + case_stmt(details::e_sf70,details::sf70_op) case_stmt(details::e_sf71,details::sf71_op) + case_stmt(details::e_sf72,details::sf72_op) case_stmt(details::e_sf73,details::sf73_op) + case_stmt(details::e_sf74,details::sf74_op) case_stmt(details::e_sf75,details::sf75_op) + case_stmt(details::e_sf76,details::sf76_op) case_stmt(details::e_sf77,details::sf77_op) + case_stmt(details::e_sf78,details::sf78_op) case_stmt(details::e_sf79,details::sf79_op) + case_stmt(details::e_sf80,details::sf80_op) case_stmt(details::e_sf81,details::sf81_op) + case_stmt(details::e_sf82,details::sf82_op) case_stmt(details::e_sf83,details::sf83_op) + case_stmt(details::e_sf84,details::sf84_op) case_stmt(details::e_sf85,details::sf85_op) + case_stmt(details::e_sf86,details::sf86_op) case_stmt(details::e_sf87,details::sf87_op) + case_stmt(details::e_sf88,details::sf88_op) case_stmt(details::e_sf89,details::sf89_op) + case_stmt(details::e_sf90,details::sf90_op) case_stmt(details::e_sf91,details::sf91_op) + case_stmt(details::e_sf92,details::sf92_op) case_stmt(details::e_sf93,details::sf93_op) + case_stmt(details::e_sf94,details::sf94_op) case_stmt(details::e_sf95,details::sf95_op) + case_stmt(details::e_sf96,details::sf96_op) case_stmt(details::e_sf97,details::sf97_op) + case_stmt(details::e_sf98,details::sf98_op) case_stmt(details::e_sf99,details::sf99_op) #undef case_stmt default : return error_node(); } @@ -13370,32 +13371,32 @@ namespace exprtk case op0 : return node_allocator_-> \ allocate_rrrr > >(v0,v1,v2,v3); \ - case_stmt(details::e_sf47,details::sf47_op) case_stmt(details::e_sf48,details::sf48_op) - case_stmt(details::e_sf49,details::sf49_op) case_stmt(details::e_sf50,details::sf50_op) - case_stmt(details::e_sf51,details::sf51_op) case_stmt(details::e_sf52,details::sf52_op) - case_stmt(details::e_sf53,details::sf53_op) case_stmt(details::e_sf54,details::sf54_op) - case_stmt(details::e_sf55,details::sf55_op) case_stmt(details::e_sf56,details::sf56_op) - case_stmt(details::e_sf57,details::sf57_op) case_stmt(details::e_sf58,details::sf58_op) - case_stmt(details::e_sf59,details::sf59_op) case_stmt(details::e_sf60,details::sf60_op) - case_stmt(details::e_sf61,details::sf61_op) case_stmt(details::e_sf62,details::sf62_op) - case_stmt(details::e_sf63,details::sf63_op) case_stmt(details::e_sf64,details::sf64_op) - case_stmt(details::e_sf65,details::sf65_op) case_stmt(details::e_sf66,details::sf66_op) - case_stmt(details::e_sf67,details::sf67_op) case_stmt(details::e_sf68,details::sf68_op) - case_stmt(details::e_sf69,details::sf69_op) case_stmt(details::e_sf70,details::sf70_op) - case_stmt(details::e_sf71,details::sf71_op) case_stmt(details::e_sf72,details::sf72_op) - case_stmt(details::e_sf73,details::sf73_op) case_stmt(details::e_sf74,details::sf74_op) - case_stmt(details::e_sf75,details::sf75_op) case_stmt(details::e_sf76,details::sf76_op) - case_stmt(details::e_sf77,details::sf77_op) case_stmt(details::e_sf78,details::sf78_op) - case_stmt(details::e_sf79,details::sf79_op) case_stmt(details::e_sf80,details::sf80_op) - case_stmt(details::e_sf81,details::sf81_op) case_stmt(details::e_sf82,details::sf82_op) - case_stmt(details::e_sf83,details::sf83_op) case_stmt(details::e_sf84,details::sf84_op) - case_stmt(details::e_sf85,details::sf85_op) case_stmt(details::e_sf86,details::sf86_op) - case_stmt(details::e_sf87,details::sf87_op) case_stmt(details::e_sf88,details::sf88_op) - case_stmt(details::e_sf89,details::sf89_op) case_stmt(details::e_sf90,details::sf90_op) - case_stmt(details::e_sf91,details::sf91_op) case_stmt(details::e_sf92,details::sf92_op) - case_stmt(details::e_sf93,details::sf93_op) case_stmt(details::e_sf94,details::sf94_op) - case_stmt(details::e_sf95,details::sf95_op) case_stmt(details::e_sf96,details::sf96_op) - case_stmt(details::e_sf97,details::sf97_op) case_stmt(details::e_sf98,details::sf98_op) + case_stmt(details::e_sf48,details::sf48_op) case_stmt(details::e_sf49,details::sf49_op) + case_stmt(details::e_sf50,details::sf50_op) case_stmt(details::e_sf51,details::sf51_op) + case_stmt(details::e_sf52,details::sf52_op) case_stmt(details::e_sf53,details::sf53_op) + case_stmt(details::e_sf54,details::sf54_op) case_stmt(details::e_sf55,details::sf55_op) + case_stmt(details::e_sf56,details::sf56_op) case_stmt(details::e_sf57,details::sf57_op) + case_stmt(details::e_sf58,details::sf58_op) case_stmt(details::e_sf59,details::sf59_op) + case_stmt(details::e_sf60,details::sf60_op) case_stmt(details::e_sf61,details::sf61_op) + case_stmt(details::e_sf62,details::sf62_op) case_stmt(details::e_sf63,details::sf63_op) + case_stmt(details::e_sf64,details::sf64_op) case_stmt(details::e_sf65,details::sf65_op) + case_stmt(details::e_sf66,details::sf66_op) case_stmt(details::e_sf67,details::sf67_op) + case_stmt(details::e_sf68,details::sf68_op) case_stmt(details::e_sf69,details::sf69_op) + case_stmt(details::e_sf70,details::sf70_op) case_stmt(details::e_sf71,details::sf71_op) + case_stmt(details::e_sf72,details::sf72_op) case_stmt(details::e_sf73,details::sf73_op) + case_stmt(details::e_sf74,details::sf74_op) case_stmt(details::e_sf75,details::sf75_op) + case_stmt(details::e_sf76,details::sf76_op) case_stmt(details::e_sf77,details::sf77_op) + case_stmt(details::e_sf78,details::sf78_op) case_stmt(details::e_sf79,details::sf79_op) + case_stmt(details::e_sf80,details::sf80_op) case_stmt(details::e_sf81,details::sf81_op) + case_stmt(details::e_sf82,details::sf82_op) case_stmt(details::e_sf83,details::sf83_op) + case_stmt(details::e_sf84,details::sf84_op) case_stmt(details::e_sf85,details::sf85_op) + case_stmt(details::e_sf86,details::sf86_op) case_stmt(details::e_sf87,details::sf87_op) + case_stmt(details::e_sf88,details::sf88_op) case_stmt(details::e_sf89,details::sf89_op) + case_stmt(details::e_sf90,details::sf90_op) case_stmt(details::e_sf91,details::sf91_op) + case_stmt(details::e_sf92,details::sf92_op) case_stmt(details::e_sf93,details::sf93_op) + case_stmt(details::e_sf94,details::sf94_op) case_stmt(details::e_sf95,details::sf95_op) + case_stmt(details::e_sf96,details::sf96_op) case_stmt(details::e_sf97,details::sf97_op) + case_stmt(details::e_sf98,details::sf98_op) case_stmt(details::e_sf99,details::sf99_op) #undef case_stmt default : return error_node(); } @@ -13415,32 +13416,32 @@ namespace exprtk case op0 : return node_allocator_-> \ allocate > >(operation,branch); \ - case_stmt(details::e_sf47,details::sf47_op) case_stmt(details::e_sf48,details::sf48_op) - case_stmt(details::e_sf49,details::sf49_op) case_stmt(details::e_sf50,details::sf50_op) - case_stmt(details::e_sf51,details::sf51_op) case_stmt(details::e_sf52,details::sf52_op) - case_stmt(details::e_sf53,details::sf53_op) case_stmt(details::e_sf54,details::sf54_op) - case_stmt(details::e_sf55,details::sf55_op) case_stmt(details::e_sf56,details::sf56_op) - case_stmt(details::e_sf57,details::sf57_op) case_stmt(details::e_sf58,details::sf58_op) - case_stmt(details::e_sf59,details::sf59_op) case_stmt(details::e_sf60,details::sf60_op) - case_stmt(details::e_sf61,details::sf61_op) case_stmt(details::e_sf62,details::sf62_op) - case_stmt(details::e_sf63,details::sf63_op) case_stmt(details::e_sf64,details::sf64_op) - case_stmt(details::e_sf65,details::sf65_op) case_stmt(details::e_sf66,details::sf66_op) - case_stmt(details::e_sf67,details::sf67_op) case_stmt(details::e_sf68,details::sf68_op) - case_stmt(details::e_sf69,details::sf69_op) case_stmt(details::e_sf70,details::sf70_op) - case_stmt(details::e_sf71,details::sf71_op) case_stmt(details::e_sf72,details::sf72_op) - case_stmt(details::e_sf73,details::sf73_op) case_stmt(details::e_sf74,details::sf74_op) - case_stmt(details::e_sf75,details::sf75_op) case_stmt(details::e_sf76,details::sf76_op) - case_stmt(details::e_sf77,details::sf77_op) case_stmt(details::e_sf78,details::sf78_op) - case_stmt(details::e_sf79,details::sf79_op) case_stmt(details::e_sf80,details::sf80_op) - case_stmt(details::e_sf81,details::sf81_op) case_stmt(details::e_sf82,details::sf82_op) - case_stmt(details::e_sf83,details::sf83_op) case_stmt(details::e_sf84,details::sf84_op) - case_stmt(details::e_sf85,details::sf85_op) case_stmt(details::e_sf86,details::sf86_op) - case_stmt(details::e_sf87,details::sf87_op) case_stmt(details::e_sf88,details::sf88_op) - case_stmt(details::e_sf89,details::sf89_op) case_stmt(details::e_sf90,details::sf90_op) - case_stmt(details::e_sf91,details::sf91_op) case_stmt(details::e_sf92,details::sf92_op) - case_stmt(details::e_sf93,details::sf93_op) case_stmt(details::e_sf94,details::sf94_op) - case_stmt(details::e_sf95,details::sf95_op) case_stmt(details::e_sf96,details::sf96_op) - case_stmt(details::e_sf97,details::sf97_op) case_stmt(details::e_sf98,details::sf98_op) + case_stmt(details::e_sf48,details::sf48_op) case_stmt(details::e_sf49,details::sf49_op) + case_stmt(details::e_sf50,details::sf50_op) case_stmt(details::e_sf51,details::sf51_op) + case_stmt(details::e_sf52,details::sf52_op) case_stmt(details::e_sf53,details::sf53_op) + case_stmt(details::e_sf54,details::sf54_op) case_stmt(details::e_sf55,details::sf55_op) + case_stmt(details::e_sf56,details::sf56_op) case_stmt(details::e_sf57,details::sf57_op) + case_stmt(details::e_sf58,details::sf58_op) case_stmt(details::e_sf59,details::sf59_op) + case_stmt(details::e_sf60,details::sf60_op) case_stmt(details::e_sf61,details::sf61_op) + case_stmt(details::e_sf62,details::sf62_op) case_stmt(details::e_sf63,details::sf63_op) + case_stmt(details::e_sf64,details::sf64_op) case_stmt(details::e_sf65,details::sf65_op) + case_stmt(details::e_sf66,details::sf66_op) case_stmt(details::e_sf67,details::sf67_op) + case_stmt(details::e_sf68,details::sf68_op) case_stmt(details::e_sf69,details::sf69_op) + case_stmt(details::e_sf70,details::sf70_op) case_stmt(details::e_sf71,details::sf71_op) + case_stmt(details::e_sf72,details::sf72_op) case_stmt(details::e_sf73,details::sf73_op) + case_stmt(details::e_sf74,details::sf74_op) case_stmt(details::e_sf75,details::sf75_op) + case_stmt(details::e_sf76,details::sf76_op) case_stmt(details::e_sf77,details::sf77_op) + case_stmt(details::e_sf78,details::sf78_op) case_stmt(details::e_sf79,details::sf79_op) + case_stmt(details::e_sf80,details::sf80_op) case_stmt(details::e_sf81,details::sf81_op) + case_stmt(details::e_sf82,details::sf82_op) case_stmt(details::e_sf83,details::sf83_op) + case_stmt(details::e_sf84,details::sf84_op) case_stmt(details::e_sf85,details::sf85_op) + case_stmt(details::e_sf86,details::sf86_op) case_stmt(details::e_sf87,details::sf87_op) + case_stmt(details::e_sf88,details::sf88_op) case_stmt(details::e_sf89,details::sf89_op) + case_stmt(details::e_sf90,details::sf90_op) case_stmt(details::e_sf91,details::sf91_op) + case_stmt(details::e_sf92,details::sf92_op) case_stmt(details::e_sf93,details::sf93_op) + case_stmt(details::e_sf94,details::sf94_op) case_stmt(details::e_sf95,details::sf95_op) + case_stmt(details::e_sf96,details::sf96_op) case_stmt(details::e_sf97,details::sf97_op) + case_stmt(details::e_sf98,details::sf98_op) case_stmt(details::e_sf99,details::sf99_op) #undef case_stmt default : return error_node(); } @@ -14082,6 +14083,7 @@ namespace exprtk case_stmt(details::e_sf24,details::sf24_op) case_stmt(details::e_sf25,details::sf25_op) case_stmt(details::e_sf26,details::sf26_op) case_stmt(details::e_sf27,details::sf27_op) case_stmt(details::e_sf28,details::sf28_op) case_stmt(details::e_sf29,details::sf29_op) + case_stmt(details::e_sf30,details::sf30_op) #undef case_stmt default : return error_node(); } @@ -14115,24 +14117,24 @@ namespace exprtk case op0 : return details::T0oT1oT2oT3_sf4ext >:: \ allocate(*(expr_gen.node_allocator_),t0,t1,t2,t3); \ - case_stmt(details::e_sf47,details::sf47_op) case_stmt(details::e_sf48,details::sf48_op) - case_stmt(details::e_sf49,details::sf49_op) case_stmt(details::e_sf50,details::sf50_op) - case_stmt(details::e_sf51,details::sf51_op) case_stmt(details::e_sf52,details::sf52_op) - case_stmt(details::e_sf53,details::sf53_op) case_stmt(details::e_sf54,details::sf54_op) - case_stmt(details::e_sf55,details::sf55_op) case_stmt(details::e_sf56,details::sf56_op) - case_stmt(details::e_sf57,details::sf57_op) case_stmt(details::e_sf58,details::sf58_op) - case_stmt(details::e_sf59,details::sf59_op) case_stmt(details::e_sf60,details::sf60_op) - case_stmt(details::e_sf61,details::sf61_op) case_stmt(details::e_sf62,details::sf62_op) - case_stmt(details::e_sf63,details::sf63_op) case_stmt(details::e_sf64,details::sf64_op) - case_stmt(details::e_sf65,details::sf65_op) case_stmt(details::e_sf66,details::sf66_op) - case_stmt(details::e_sf67,details::sf67_op) case_stmt(details::e_sf68,details::sf68_op) - case_stmt(details::e_sf69,details::sf69_op) case_stmt(details::e_sf70,details::sf70_op) - case_stmt(details::e_sf71,details::sf71_op) case_stmt(details::e_sf72,details::sf72_op) - case_stmt(details::e_sf73,details::sf73_op) case_stmt(details::e_sf74,details::sf74_op) - case_stmt(details::e_sf75,details::sf75_op) case_stmt(details::e_sf76,details::sf76_op) - case_stmt(details::e_sf77,details::sf77_op) case_stmt(details::e_sf78,details::sf78_op) - case_stmt(details::e_sf79,details::sf79_op) case_stmt(details::e_sf80,details::sf80_op) - case_stmt(details::e_sf81,details::sf81_op) case_stmt(details::e_sf82,details::sf82_op) + case_stmt(details::e_sf48,details::sf48_op) case_stmt(details::e_sf49,details::sf49_op) + case_stmt(details::e_sf50,details::sf50_op) case_stmt(details::e_sf51,details::sf51_op) + case_stmt(details::e_sf52,details::sf52_op) case_stmt(details::e_sf53,details::sf53_op) + case_stmt(details::e_sf54,details::sf54_op) case_stmt(details::e_sf55,details::sf55_op) + case_stmt(details::e_sf56,details::sf56_op) case_stmt(details::e_sf57,details::sf57_op) + case_stmt(details::e_sf58,details::sf58_op) case_stmt(details::e_sf59,details::sf59_op) + case_stmt(details::e_sf60,details::sf60_op) case_stmt(details::e_sf61,details::sf61_op) + case_stmt(details::e_sf62,details::sf62_op) case_stmt(details::e_sf63,details::sf63_op) + case_stmt(details::e_sf64,details::sf64_op) case_stmt(details::e_sf65,details::sf65_op) + case_stmt(details::e_sf66,details::sf66_op) case_stmt(details::e_sf67,details::sf67_op) + case_stmt(details::e_sf68,details::sf68_op) case_stmt(details::e_sf69,details::sf69_op) + case_stmt(details::e_sf70,details::sf70_op) case_stmt(details::e_sf71,details::sf71_op) + case_stmt(details::e_sf72,details::sf72_op) case_stmt(details::e_sf73,details::sf73_op) + case_stmt(details::e_sf74,details::sf74_op) case_stmt(details::e_sf75,details::sf75_op) + case_stmt(details::e_sf76,details::sf76_op) case_stmt(details::e_sf77,details::sf77_op) + case_stmt(details::e_sf78,details::sf78_op) case_stmt(details::e_sf79,details::sf79_op) + case_stmt(details::e_sf80,details::sf80_op) case_stmt(details::e_sf81,details::sf81_op) + case_stmt(details::e_sf82,details::sf82_op) case_stmt(details::e_sf83,details::sf83_op) case_stmt(details::e_sf4ext00,details::sfext00_op) case_stmt(details::e_sf4ext01,details::sfext01_op) case_stmt(details::e_sf4ext02,details::sfext02_op) case_stmt(details::e_sf4ext03,details::sfext03_op) case_stmt(details::e_sf4ext04,details::sfext04_op) case_stmt(details::e_sf4ext05,details::sfext05_op) @@ -15210,13 +15212,21 @@ namespace exprtk return (synthesis_result) ? result : error_node(); } // (c0 + v0) - (c1 + v1) --> (covov) (c0 - c1) + v0 - v1 - if ((details::e_add == o0) && (details::e_sub == o1) && (details::e_add == o2)) + else if ((details::e_add == o0) && (details::e_sub == o1) && (details::e_add == o2)) { const bool synthesis_result = synthesize_sf3ext_expression:: template compile(expr_gen,"(t+t)-t",(c0 - c1),v0,v1,result); return (synthesis_result) ? result : error_node(); } + // (c0 - v0) - (c1 - v1) --> (covov) (c0 - c1) - v0 + v1 + else if ((details::e_sub == o0) && (details::e_sub == o1) && (details::e_sub == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t-t)+t",(c0 - c1),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } // (c0 * v0) * (c1 * v1) --> (covov) (c0 * c1) * v0 * v1 else if ((details::e_mul == o0) && (details::e_mul == o1) && (details::e_mul == o2)) { @@ -15282,13 +15292,21 @@ namespace exprtk return (synthesis_result) ? result : error_node(); } // (v0 + c0) - (v1 + c1) --> (covov) (c0 - c1) + v0 - v1 - if ((details::e_add == o0) && (details::e_sub == o1) && (details::e_add == o2)) + else if ((details::e_add == o0) && (details::e_sub == o1) && (details::e_add == o2)) { const bool synthesis_result = synthesize_sf3ext_expression:: template compile(expr_gen,"(t+t)-t",(c0 - c1),v0,v1,result); return (synthesis_result) ? result : error_node(); } + // (v0 - c0) - (v1 - c1) --> (covov) (c1 - c0) + v0 - v1 + else if ((details::e_sub == o0) && (details::e_sub == o1) && (details::e_sub == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t+t)-t",(c1 - c0),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } // (c0 * v0) * (c1 * v1) --> (covov) (c0 * c1) * v0 * v1 else if ((details::e_mul == o0) && (details::e_mul == o1) && (details::e_mul == o2)) { @@ -15344,7 +15362,40 @@ namespace exprtk details::free_node(*(expr_gen.node_allocator_),branch[0]); details::free_node(*(expr_gen.node_allocator_),branch[1]); expression_node_ptr result = error_node(); - if (synthesize_sf4ext_expression::template compile(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,v1,c1,result)) + + // (c0 + v0) + (v1 + c1) --> (covov) (c0 + c1) + v0 + v1 + if ((details::e_add == o0) && (details::e_add == o1) && (details::e_add == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t+t)+t",(c0 + c1),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } + // (c0 + v0) - (v1 + c1) --> (covov) (c0 - c1) + v0 - v1 + else if ((details::e_add == o0) && (details::e_sub == o1) && (details::e_add == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t+t)-t",(c0 - c1),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } + // (c0 - v0) - (v1 - c1) --> (covov) (c0 + c1) - v0 - v1 + else if ((details::e_sub == o0) && (details::e_sub == o1) && (details::e_sub == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"t-(t+t)",(c0 + c1),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } + // (c0 * v0) * (c1 * v1) --> (covov) (c0 * c1) * v0 * v1 + else if ((details::e_mul == o0) && (details::e_mul == o1) && (details::e_mul == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t*t)*t",(c0 * c1),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } + else if (synthesize_sf4ext_expression::template compile(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,v1,c1,result)) return result; else if (!expr_gen.valid_operator(o0,f0)) return error_node(); @@ -15391,7 +15442,40 @@ namespace exprtk details::free_node(*(expr_gen.node_allocator_),branch[0]); details::free_node(*(expr_gen.node_allocator_),branch[1]); expression_node_ptr result = error_node(); - if (synthesize_sf4ext_expression::template compile(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,c1,v1,result)) + + // (v0 + c0) + (c1 + v1) --> (covov) (c0 + c1) + v0 + v1 + if ((details::e_add == o0) && (details::e_add == o1) && (details::e_add == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t+t)+t",(c0 + c1),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } + // (v0 + c0) - (c1 + v1) --> (covov) (c0 - c1) + v0 - v1 + else if ((details::e_add == o0) && (details::e_sub == o1) && (details::e_add == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t+t)-t",(c0 - c1),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } + // (v0 - c0) - (c1 - v1) --> (vovoc) v0 + v1 - (c1 + c0) + else if ((details::e_sub == o0) && (details::e_sub == o1) && (details::e_sub == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t+t)-t",v0,v1,(c1 + c0),result); + return (synthesis_result) ? result : error_node(); + } + // (c0 * v0) * (c1 * v1) --> (covov) (c0 * c1) * v0 * v1 + else if ((details::e_mul == o0) && (details::e_mul == o1) && (details::e_mul == o2)) + { + const bool synthesis_result = + synthesize_sf3ext_expression:: + template compile(expr_gen,"(t*t)*t",(c0 * c1),v0,v1,result); + return (synthesis_result) ? result : error_node(); + } + else if (synthesize_sf4ext_expression::template compile(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,c1,v1,result)) return result; else if (!expr_gen.valid_operator(o0,f0)) return error_node(); @@ -17559,7 +17643,7 @@ namespace exprtk register_sf3(16) register_sf3(17) register_sf3(18) register_sf3(19) register_sf3(20) register_sf3(21) register_sf3(22) register_sf3(23) register_sf3(24) register_sf3(25) register_sf3(26) register_sf3(27) - register_sf3(28) register_sf3(29) + register_sf3(28) register_sf3(29) register_sf3(30) #undef register_sf3 } @@ -17570,15 +17654,15 @@ namespace exprtk #define register_sf4(Op) \ sf4_map[details::sf##Op##_op::id()] = pair_t(details::sf##Op##_op::process,details::e_sf##Op); \ - register_sf4(47) register_sf4(48) register_sf4(49) register_sf4(50) - register_sf4(51) register_sf4(52) register_sf4(53) register_sf4(54) - register_sf4(55) register_sf4(56) register_sf4(57) register_sf4(58) - register_sf4(59) register_sf4(60) register_sf4(61) register_sf4(62) - register_sf4(63) register_sf4(64) register_sf4(65) register_sf4(66) - register_sf4(67) register_sf4(68) register_sf4(69) register_sf4(70) - register_sf4(71) register_sf4(72) register_sf4(73) register_sf4(74) - register_sf4(75) register_sf4(76) register_sf4(77) register_sf4(78) - register_sf4(79) register_sf4(80) register_sf4(81) register_sf4(82) + register_sf4(48) register_sf4(49) register_sf4(50) register_sf4(51) + register_sf4(52) register_sf4(53) register_sf4(54) register_sf4(55) + register_sf4(56) register_sf4(57) register_sf4(58) register_sf4(59) + register_sf4(60) register_sf4(61) register_sf4(62) register_sf4(63) + register_sf4(64) register_sf4(65) register_sf4(66) register_sf4(67) + register_sf4(68) register_sf4(69) register_sf4(70) register_sf4(71) + register_sf4(72) register_sf4(73) register_sf4(74) register_sf4(75) + register_sf4(76) register_sf4(77) register_sf4(78) register_sf4(79) + register_sf4(80) register_sf4(81) register_sf4(82) register_sf4(83) #undef register_sf4 #define register_sf4ext(Op) \ diff --git a/exprtk_test.cpp b/exprtk_test.cpp index 1c6685a..38a6f42 100644 --- a/exprtk_test.cpp +++ b/exprtk_test.cpp @@ -32,8 +32,8 @@ typedef std::pair test_t; static const test_t test_list[] = { - // Note: Each of following tests should all - // compile down to a single literal node. + // Note: Each of following tests should compile down + // to a single literal node. test_t("0",0.0), test_t("1",1.0), test_t("2",2.0), @@ -779,101 +779,102 @@ static const test_t test_list[] = test_t("equal($f01(1.1,2.2,3.3),(1.1+2.2)*3.3)",1.0), test_t("equal($f02(1.1,2.2,3.3),(1.1+2.2)-3.3)",1.0), test_t("equal($f03(1.1,2.2,3.3),(1.1+2.2)+3.3)",1.0), - test_t("equal($f04(1.1,2.2,3.3),(1.1-2.2)/3.3)",1.0), - test_t("equal($f05(1.1,2.2,3.3),(1.1-2.2)*3.3)",1.0), - test_t("equal($f06(1.1,2.2,3.3),(1.1*2.2)+3.3)",1.0), - test_t("equal($f07(1.1,2.2,3.3),(1.1*2.2)-3.3)",1.0), - test_t("equal($f08(1.1,2.2,3.3),(1.1*2.2)/3.3)",1.0), - test_t("equal($f09(1.1,2.2,3.3),(1.1*2.2)*3.3)",1.0), - test_t("equal($f10(1.1,2.2,3.3),(1.1/2.2)+3.3)",1.0), - test_t("equal($f11(1.1,2.2,3.3),(1.1/2.2)-3.3)",1.0), - test_t("equal($f12(1.1,2.2,3.3),(1.1/2.2)/3.3)",1.0), - test_t("equal($f13(1.1,2.2,3.3),(1.1/2.2)*3.3)",1.0), - test_t("equal($f14(1.1,2.2,3.3),1.1/(2.2+3.3))",1.0), - test_t("equal($f15(1.1,2.2,3.3),1.1/(2.2-3.3))",1.0), - test_t("equal($f16(1.1,2.2,3.3),1.1/(2.2*3.3))",1.0), - test_t("equal($f17(1.1,2.2,3.3),1.1/(2.2/3.3))",1.0), - test_t("equal($f18(1.1,2.2,3.3),1.1*(2.2+3.3))",1.0), - test_t("equal($f19(1.1,2.2,3.3),1.1*(2.2-3.3))",1.0), - test_t("equal($f20(1.1,2.2,3.3),1.1*(2.2*3.3))",1.0), - test_t("equal($f21(1.1,2.2,3.3),1.1*(2.2/3.3))",1.0), - test_t("equal($f22(1.1,2.2,3.3),1.1-(2.2+3.3))",1.0), - test_t("equal($f23(1.1,2.2,3.3),1.1-(2.2-3.3))",1.0), - test_t("equal($f24(1.1,2.2,3.3),1.1-(2.2/3.3))",1.0), - test_t("equal($f25(1.1,2.2,3.3),1.1-(2.2*3.3))",1.0), - test_t("equal($f26(1.1,2.2,3.3),1.1+(2.2*3.3))",1.0), - test_t("equal($f27(1.1,2.2,3.3),1.1+(2.2/3.3))",1.0), - test_t("equal($f28(1.1,2.2,3.3),1.1+(2.2+3.3))",1.0), - test_t("equal($f29(1.1,2.2,3.3),1.1+(2.2-3.3))",1.0), - test_t("equal($f30(1.1,2.2,3.3),1.1*2.2^2+3.3)",1.0), - test_t("equal($f31(1.1,2.2,3.3),1.1*2.2^3+3.3)",1.0), - test_t("equal($f32(1.1,2.2,3.3),1.1*2.2^4+3.3)",1.0), - test_t("equal($f33(1.1,2.2,3.3),1.1*2.2^5+3.3)",1.0), - test_t("equal($f34(1.1,2.2,3.3),1.1*2.2^6+3.3)",1.0), - test_t("equal($f35(1.1,2.2,3.3),1.1*2.2^7+3.3)",1.0), - test_t("equal($f36(1.1,2.2,3.3),1.1*2.2^8+3.3)",1.0), - test_t("equal($f37(1.1,2.2,3.3),1.1*2.2^9+3.3)",1.0), - test_t("equal($f38(1.1,2.2,3.3),1.1*log(2.2)+3.3)",1.0), - test_t("equal($f39(1.1,2.2,3.3),1.1*log(2.2)-3.3)",1.0), - test_t("equal($f40(1.1,2.2,3.3),1.1*log10(2.2)+3.3)",1.0), - test_t("equal($f41(1.1,2.2,3.3),1.1*log10(2.2)-3.3)",1.0), - test_t("equal($f42(1.1,2.2,3.3),1.1*sin(2.2)+3.3)",1.0), - test_t("equal($f43(1.1,2.2,3.3),1.1*sin(2.2)-3.3)",1.0), - test_t("equal($f44(1.1,2.2,3.3),1.1*cos(2.2)+3.3)",1.0), - test_t("equal($f45(1.1,2.2,3.3),1.1*cos(2.2)-3.3)",1.0), - test_t("equal($f46(1.1,2.2,3.3),if(0!=1.1,2.2,3.3))",1.0), - test_t("equal($f47(1.1,2.2,3.3,4.4),1.1+((2.2+3.3)/4.4))",1.0), - test_t("equal($f48(1.1,2.2,3.3,4.4),1.1+((2.2+3.3)*4.4))",1.0), - test_t("equal($f49(1.1,2.2,3.3,4.4),1.1+((2.2-3.3)/4.4))",1.0), - test_t("equal($f50(1.1,2.2,3.3,4.4),1.1+((2.2-3.3)*4.4))",1.0), - test_t("equal($f51(1.1,2.2,3.3,4.4),1.1+((2.2*3.3)/4.4))",1.0), - test_t("equal($f52(1.1,2.2,3.3,4.4),1.1+((2.2*3.3)*4.4))",1.0), - test_t("equal($f53(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)+4.4))",1.0), - test_t("equal($f54(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)/4.4))",1.0), - test_t("equal($f55(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)*4.4))",1.0), - test_t("equal($f56(1.1,2.2,3.3,4.4),1.1-((2.2+3.3)/4.4))",1.0), - test_t("equal($f57(1.1,2.2,3.3,4.4),1.1-((2.2+3.3)*4.4))",1.0), - test_t("equal($f58(1.1,2.2,3.3,4.4),1.1-((2.2-3.3)/4.4))",1.0), - test_t("equal($f59(1.1,2.2,3.3,4.4),1.1-((2.2-3.3)*4.4))",1.0), - test_t("equal($f60(1.1,2.2,3.3,4.4),1.1-((2.2*3.3)/4.4))",1.0), - test_t("equal($f61(1.1,2.2,3.3,4.4),1.1-((2.2*3.3)*4.4))",1.0), - test_t("equal($f62(1.1,2.2,3.3,4.4),1.1-((2.2/3.3)/4.4))",1.0), - test_t("equal($f63(1.1,2.2,3.3,4.4),1.1-((2.2/3.3)*4.4))",1.0), - test_t("equal($f64(1.1,2.2,3.3,4.4),((1.1+2.2)*3.3)-4.4)",1.0), - test_t("equal($f65(1.1,2.2,3.3,4.4),((1.1-2.2)*3.3)-4.4)",1.0), - test_t("equal($f66(1.1,2.2,3.3,4.4),((1.1*2.2)*3.3)-4.4)",1.0), - test_t("equal($f67(1.1,2.2,3.3,4.4),((1.1/2.2)*3.3)-4.4)",1.0), - test_t("equal($f68(1.1,2.2,3.3,4.4),((1.1+2.2)/3.3)-4.4)",1.0), - test_t("equal($f69(1.1,2.2,3.3,4.4),((1.1-2.2)/3.3)-4.4)",1.0), - test_t("equal($f70(1.1,2.2,3.3,4.4),((1.1*2.2)/3.3)-4.4)",1.0), - test_t("equal($f71(1.1,2.2,3.3,4.4),((1.1/2.2)/3.3)-4.4)",1.0), - test_t("equal($f72(1.1,2.2,3.3,4.4),(1.1*2.2)+(3.3*4.4))",1.0), - test_t("equal($f73(1.1,2.2,3.3,4.4),(1.1*2.2)-(3.3*4.4))",1.0), - test_t("equal($f74(1.1,2.2,3.3,4.4),(1.1*2.2)+(3.3/4.4))",1.0), - test_t("equal($f75(1.1,2.2,3.3,4.4),(1.1*2.2)-(3.3/4.4))",1.0), - test_t("equal($f76(1.1,2.2,3.3,4.4),(1.1/2.2)+(3.3/4.4))",1.0), - test_t("equal($f77(1.1,2.2,3.3,4.4),(1.1/2.2)-(3.3/4.4))",1.0), - test_t("equal($f78(1.1,2.2,3.3,4.4),(1.1/2.2)-(3.3*4.4))",1.0), - test_t("equal($f79(1.1,2.2,3.3,4.4),1.1/(2.2+(3.3*4.4)))",1.0), - test_t("equal($f80(1.1,2.2,3.3,4.4),1.1/(2.2-(3.3*4.4)))",1.0), - test_t("equal($f81(1.1,2.2,3.3,4.4),1.1*(2.2+(3.3*4.4)))",1.0), - test_t("equal($f82(1.1,2.2,3.3,4.4),1.1*(2.2-(3.3*4.4)))",1.0), - test_t("equal($f83(1.1,2.2,3.3,4.4),1.1*2.2^2+3.3*4.4^2)",1.0), - test_t("equal($f84(1.1,2.2,3.3,4.4),1.1*2.2^3+3.3*4.4^3)",1.0), - test_t("equal($f85(1.1,2.2,3.3,4.4),1.1*2.2^4+3.3*4.4^4)",1.0), - test_t("equal($f86(1.1,2.2,3.3,4.4),1.1*2.2^5+3.3*4.4^5)",1.0), - test_t("equal($f87(1.1,2.2,3.3,4.4),1.1*2.2^6+3.3*4.4^6)",1.0), - test_t("equal($f88(1.1,2.2,3.3,4.4),1.1*2.2^7+3.3*4.4^7)",1.0), - test_t("equal($f89(1.1,2.2,3.3,4.4),1.1*2.2^8+3.3*4.4^8)",1.0), - test_t("equal($f90(1.1,2.2,3.3,4.4),1.1*2.2^9+3.3*4.4^9)",1.0), - test_t("equal($f91(1.1,2.2,3.3,4.4),if(1.1 and 2.2,3.3,4.4))",1.0), - test_t("equal($f92(1.1,2.2,3.3,4.4),if(1.1 or 2.2,3.3,4.4))",1.0), - test_t("equal($f93(1.1,2.2,3.3,4.4),if(1.1 < 2.2,3.3,4.4))",1.0), - test_t("equal($f94(1.1,2.2,3.3,4.4),if(1.1 <= 2.2,3.3,4.4))",1.0), - test_t("equal($f95(1.1,2.2,3.3,4.4),if(1.1 > 2.2,3.3,4.4))",1.0), - test_t("equal($f96(1.1,2.2,3.3,4.4),if(1.1 >= 2.2,3.3,4.4))",1.0), - test_t("equal($f97(1.1,2.2,3.3,4.4),if(equal(1.1,2.2),3.3,4.4))",1.0), - test_t("equal($f98(1.1,2.2,3.3,4.4),1.1*sin(2.2)+3.3*cos(4.4))",1.0), + test_t("equal($f04(1.1,2.2,3.3),(1.1-2.2)+3.3)",1.0), + test_t("equal($f05(1.1,2.2,3.3),(1.1-2.2)/3.3)",1.0), + test_t("equal($f06(1.1,2.2,3.3),(1.1-2.2)*3.3)",1.0), + test_t("equal($f07(1.1,2.2,3.3),(1.1*2.2)+3.3)",1.0), + test_t("equal($f08(1.1,2.2,3.3),(1.1*2.2)-3.3)",1.0), + test_t("equal($f09(1.1,2.2,3.3),(1.1*2.2)/3.3)",1.0), + test_t("equal($f10(1.1,2.2,3.3),(1.1*2.2)*3.3)",1.0), + test_t("equal($f11(1.1,2.2,3.3),(1.1/2.2)+3.3)",1.0), + test_t("equal($f12(1.1,2.2,3.3),(1.1/2.2)-3.3)",1.0), + test_t("equal($f13(1.1,2.2,3.3),(1.1/2.2)/3.3)",1.0), + test_t("equal($f14(1.1,2.2,3.3),(1.1/2.2)*3.3)",1.0), + test_t("equal($f15(1.1,2.2,3.3),1.1/(2.2+3.3))",1.0), + test_t("equal($f16(1.1,2.2,3.3),1.1/(2.2-3.3))",1.0), + test_t("equal($f17(1.1,2.2,3.3),1.1/(2.2*3.3))",1.0), + test_t("equal($f18(1.1,2.2,3.3),1.1/(2.2/3.3))",1.0), + test_t("equal($f19(1.1,2.2,3.3),1.1*(2.2+3.3))",1.0), + test_t("equal($f20(1.1,2.2,3.3),1.1*(2.2-3.3))",1.0), + test_t("equal($f21(1.1,2.2,3.3),1.1*(2.2*3.3))",1.0), + test_t("equal($f22(1.1,2.2,3.3),1.1*(2.2/3.3))",1.0), + test_t("equal($f23(1.1,2.2,3.3),1.1-(2.2+3.3))",1.0), + test_t("equal($f24(1.1,2.2,3.3),1.1-(2.2-3.3))",1.0), + test_t("equal($f25(1.1,2.2,3.3),1.1-(2.2/3.3))",1.0), + test_t("equal($f26(1.1,2.2,3.3),1.1-(2.2*3.3))",1.0), + test_t("equal($f27(1.1,2.2,3.3),1.1+(2.2*3.3))",1.0), + test_t("equal($f28(1.1,2.2,3.3),1.1+(2.2/3.3))",1.0), + test_t("equal($f29(1.1,2.2,3.3),1.1+(2.2+3.3))",1.0), + test_t("equal($f30(1.1,2.2,3.3),1.1+(2.2-3.3))",1.0), + test_t("equal($f31(1.1,2.2,3.3),1.1*2.2^2+3.3)",1.0), + test_t("equal($f32(1.1,2.2,3.3),1.1*2.2^3+3.3)",1.0), + test_t("equal($f33(1.1,2.2,3.3),1.1*2.2^4+3.3)",1.0), + test_t("equal($f34(1.1,2.2,3.3),1.1*2.2^5+3.3)",1.0), + test_t("equal($f35(1.1,2.2,3.3),1.1*2.2^6+3.3)",1.0), + test_t("equal($f36(1.1,2.2,3.3),1.1*2.2^7+3.3)",1.0), + test_t("equal($f37(1.1,2.2,3.3),1.1*2.2^8+3.3)",1.0), + test_t("equal($f38(1.1,2.2,3.3),1.1*2.2^9+3.3)",1.0), + test_t("equal($f39(1.1,2.2,3.3),1.1*log(2.2)+3.3)",1.0), + test_t("equal($f40(1.1,2.2,3.3),1.1*log(2.2)-3.3)",1.0), + test_t("equal($f41(1.1,2.2,3.3),1.1*log10(2.2)+3.3)",1.0), + test_t("equal($f42(1.1,2.2,3.3),1.1*log10(2.2)-3.3)",1.0), + test_t("equal($f43(1.1,2.2,3.3),1.1*sin(2.2)+3.3)",1.0), + test_t("equal($f44(1.1,2.2,3.3),1.1*sin(2.2)-3.3)",1.0), + test_t("equal($f45(1.1,2.2,3.3),1.1*cos(2.2)+3.3)",1.0), + test_t("equal($f46(1.1,2.2,3.3),1.1*cos(2.2)-3.3)",1.0), + test_t("equal($f47(1.1,2.2,3.3),if(0!=1.1,2.2,3.3))",1.0), + test_t("equal($f48(1.1,2.2,3.3,4.4),1.1+((2.2+3.3)/4.4))",1.0), + test_t("equal($f49(1.1,2.2,3.3,4.4),1.1+((2.2+3.3)*4.4))",1.0), + test_t("equal($f50(1.1,2.2,3.3,4.4),1.1+((2.2-3.3)/4.4))",1.0), + test_t("equal($f51(1.1,2.2,3.3,4.4),1.1+((2.2-3.3)*4.4))",1.0), + test_t("equal($f52(1.1,2.2,3.3,4.4),1.1+((2.2*3.3)/4.4))",1.0), + test_t("equal($f53(1.1,2.2,3.3,4.4),1.1+((2.2*3.3)*4.4))",1.0), + test_t("equal($f54(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)+4.4))",1.0), + test_t("equal($f55(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)/4.4))",1.0), + test_t("equal($f56(1.1,2.2,3.3,4.4),1.1+((2.2/3.3)*4.4))",1.0), + test_t("equal($f57(1.1,2.2,3.3,4.4),1.1-((2.2+3.3)/4.4))",1.0), + test_t("equal($f58(1.1,2.2,3.3,4.4),1.1-((2.2+3.3)*4.4))",1.0), + test_t("equal($f59(1.1,2.2,3.3,4.4),1.1-((2.2-3.3)/4.4))",1.0), + test_t("equal($f60(1.1,2.2,3.3,4.4),1.1-((2.2-3.3)*4.4))",1.0), + test_t("equal($f61(1.1,2.2,3.3,4.4),1.1-((2.2*3.3)/4.4))",1.0), + test_t("equal($f62(1.1,2.2,3.3,4.4),1.1-((2.2*3.3)*4.4))",1.0), + test_t("equal($f63(1.1,2.2,3.3,4.4),1.1-((2.2/3.3)/4.4))",1.0), + test_t("equal($f64(1.1,2.2,3.3,4.4),1.1-((2.2/3.3)*4.4))",1.0), + test_t("equal($f65(1.1,2.2,3.3,4.4),((1.1+2.2)*3.3)-4.4)",1.0), + test_t("equal($f66(1.1,2.2,3.3,4.4),((1.1-2.2)*3.3)-4.4)",1.0), + test_t("equal($f67(1.1,2.2,3.3,4.4),((1.1*2.2)*3.3)-4.4)",1.0), + test_t("equal($f68(1.1,2.2,3.3,4.4),((1.1/2.2)*3.3)-4.4)",1.0), + test_t("equal($f69(1.1,2.2,3.3,4.4),((1.1+2.2)/3.3)-4.4)",1.0), + test_t("equal($f70(1.1,2.2,3.3,4.4),((1.1-2.2)/3.3)-4.4)",1.0), + test_t("equal($f71(1.1,2.2,3.3,4.4),((1.1*2.2)/3.3)-4.4)",1.0), + test_t("equal($f72(1.1,2.2,3.3,4.4),((1.1/2.2)/3.3)-4.4)",1.0), + test_t("equal($f73(1.1,2.2,3.3,4.4),(1.1*2.2)+(3.3*4.4))",1.0), + test_t("equal($f74(1.1,2.2,3.3,4.4),(1.1*2.2)-(3.3*4.4))",1.0), + test_t("equal($f75(1.1,2.2,3.3,4.4),(1.1*2.2)+(3.3/4.4))",1.0), + test_t("equal($f76(1.1,2.2,3.3,4.4),(1.1*2.2)-(3.3/4.4))",1.0), + test_t("equal($f77(1.1,2.2,3.3,4.4),(1.1/2.2)+(3.3/4.4))",1.0), + test_t("equal($f78(1.1,2.2,3.3,4.4),(1.1/2.2)-(3.3/4.4))",1.0), + test_t("equal($f79(1.1,2.2,3.3,4.4),(1.1/2.2)-(3.3*4.4))",1.0), + test_t("equal($f80(1.1,2.2,3.3,4.4),1.1/(2.2+(3.3*4.4)))",1.0), + test_t("equal($f81(1.1,2.2,3.3,4.4),1.1/(2.2-(3.3*4.4)))",1.0), + test_t("equal($f82(1.1,2.2,3.3,4.4),1.1*(2.2+(3.3*4.4)))",1.0), + test_t("equal($f83(1.1,2.2,3.3,4.4),1.1*(2.2-(3.3*4.4)))",1.0), + test_t("equal($f84(1.1,2.2,3.3,4.4),1.1*2.2^2+3.3*4.4^2)",1.0), + test_t("equal($f85(1.1,2.2,3.3,4.4),1.1*2.2^3+3.3*4.4^3)",1.0), + test_t("equal($f86(1.1,2.2,3.3,4.4),1.1*2.2^4+3.3*4.4^4)",1.0), + test_t("equal($f87(1.1,2.2,3.3,4.4),1.1*2.2^5+3.3*4.4^5)",1.0), + test_t("equal($f88(1.1,2.2,3.3,4.4),1.1*2.2^6+3.3*4.4^6)",1.0), + test_t("equal($f89(1.1,2.2,3.3,4.4),1.1*2.2^7+3.3*4.4^7)",1.0), + test_t("equal($f90(1.1,2.2,3.3,4.4),1.1*2.2^8+3.3*4.4^8)",1.0), + test_t("equal($f91(1.1,2.2,3.3,4.4),1.1*2.2^9+3.3*4.4^9)",1.0), + test_t("equal($f92(1.1,2.2,3.3,4.4),if(1.1 and 2.2,3.3,4.4))",1.0), + test_t("equal($f93(1.1,2.2,3.3,4.4),if(1.1 or 2.2,3.3,4.4))",1.0), + test_t("equal($f94(1.1,2.2,3.3,4.4),if(1.1 < 2.2,3.3,4.4))",1.0), + test_t("equal($f95(1.1,2.2,3.3,4.4),if(1.1 <= 2.2,3.3,4.4))",1.0), + test_t("equal($f96(1.1,2.2,3.3,4.4),if(1.1 > 2.2,3.3,4.4))",1.0), + test_t("equal($f97(1.1,2.2,3.3,4.4),if(1.1 >= 2.2,3.3,4.4))",1.0), + test_t("equal($f98(1.1,2.2,3.3,4.4),if(equal(1.1,2.2),3.3,4.4))",1.0), + test_t("equal($f99(1.1,2.2,3.3,4.4),1.1*sin(2.2)+3.3*cos(4.4))",1.0), test_t("equal((48.0/2.0*(9.0+3.0)),288.0)",1.0), test_t("equal((48.0/2.0(9.0+3.0)),288.0)",1.0), test_t("equal((6.0/2.0(1.0+2.0)),9.0)",1.0), @@ -1300,6 +1301,54 @@ inline bool run_test01() test_xy("equal(y^-23,1/(y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), test_xy("equal(y^-24,1/(y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), test_xy("equal(y^-25,1/(y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y*y))",T(0.0),T(12.34),T(1.0)), + test_xy("(2 + x) + 7",T(3.0),T(0.0),T((2.0 + 3.0) + 7.0)), + test_xy("(2 + x) - 7",T(3.0),T(0.0),T((2.0 + 3.0) - 7.0)), + test_xy("(2 - x) + 7",T(3.0),T(0.0),T((2.0 - 3.0) + 7.0)), + test_xy("(2 - x) - 7",T(3.0),T(0.0),T((2.0 - 3.0) - 7.0)), + test_xy("(2 * x) * 7",T(3.0),T(0.0),T((2.0 * 3.0) * 7.0)), + test_xy("(2 * x) / 7",T(3.0),T(0.0),T((2.0 * 3.0) / 7.0)), + test_xy("(2 / x) * 7",T(3.0),T(0.0),T((2.0 / 3.0) * 7.0)), + test_xy("(2 / x) / 7",T(3.0),T(0.0),T((2.0 / 3.0) / 7.0)), + test_xy("2 + (x + 7)",T(3.0),T(0.0),T(2.0 + (3.0 + 7.0))), + test_xy("2 + (x - 7)",T(3.0),T(0.0),T(2.0 + (3.0 - 7.0))), + test_xy("2 - (x + 7)",T(3.0),T(0.0),T(2.0 - (3.0 + 7.0))), + test_xy("2 - (x - 7)",T(3.0),T(0.0),T(2.0 - (3.0 - 7.0))), + test_xy("2 * (x * 7)",T(3.0),T(0.0),T(2.0 * (3.0 * 7.0))), + test_xy("2 * (x / 7)",T(3.0),T(0.0),T(2.0 * (3.0 / 7.0))), + test_xy("2 / (x * 7)",T(3.0),T(0.0),T(2.0 / (3.0 * 7.0))), + test_xy("2 / (x / 7)",T(3.0),T(0.0),T(2.0 / (3.0 / 7.0))), + test_xy("2 + (7 + x)",T(3.0),T(0.0),T(2.0 + (7.0 + 3.0))), + test_xy("2 + (7 - x)",T(3.0),T(0.0),T(2.0 + (7.0 - 3.0))), + test_xy("2 - (7 + x)",T(3.0),T(0.0),T(2.0 - (7.0 + 3.0))), + test_xy("2 - (7 - x)",T(3.0),T(0.0),T(2.0 - (7.0 - 3.0))), + test_xy("2 * (7 * x)",T(3.0),T(0.0),T(2.0 * (7.0 * 3.0))), + test_xy("2 * (7 / x)",T(3.0),T(0.0),T(2.0 * (7.0 / 3.0))), + test_xy("2 / (7 * x)",T(3.0),T(0.0),T(2.0 / (7.0 * 3.0))), + test_xy("2 / (7 / x)",T(3.0),T(0.0),T(2.0 / (7.0 / 3.0))), + test_xy("(x + 2) + 7",T(3.0),T(0.0),T((3.0 + 2.0) + 7.0)), + test_xy("(x + 2) - 7",T(3.0),T(0.0),T((3.0 + 2.0) - 7.0)), + test_xy("(x - 2) + 7",T(3.0),T(0.0),T((3.0 - 2.0) + 7.0)), + test_xy("(x - 2) - 7",T(3.0),T(0.0),T((3.0 - 2.0) - 7.0)), + test_xy("(x * 2) * 7",T(3.0),T(0.0),T((3.0 * 2.0) * 7.0)), + test_xy("(x * 2) / 7",T(3.0),T(0.0),T((3.0 * 2.0) / 7.0)), + test_xy("(x / 2) * 7",T(3.0),T(0.0),T((3.0 / 2.0) * 7.0)), + test_xy("(x / 2) / 7",T(3.0),T(0.0),T((3.0 / 2.0) / 7.0)), + test_xy("((2 + x) + (3 + y))",T(7.0),T(9.0),T(((2.0 + 7.0) + (3.0 + 9.0)))), + test_xy("((2 + x) - (3 + y))",T(7.0),T(9.0),T(((2.0 + 7.0) - (3.0 + 9.0)))), + test_xy("((2 - x) - (3 - y))",T(7.0),T(9.0),T(((2.0 - 7.0) - (3.0 - 9.0)))), + test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), + test_xy("((x + 2) + (y + 3))",T(7.0),T(9.0),T(((7.0 + 2.0) + (9.0 + 3.0)))), + test_xy("((x + 2) - (y + 3))",T(7.0),T(9.0),T(((7.0 + 2.0) - (9.0 + 3.0)))), + test_xy("((x - 2) - (y - 3))",T(7.0),T(9.0),T(((7.0 - 2.0) - (9.0 - 3.0)))), + test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), + test_xy("((2 + x) + (y + 3))",T(7.0),T(9.0),T(((2.0 + 7.0) + (9.0 + 3.0)))), + test_xy("((2 + x) - (y + 3))",T(7.0),T(9.0),T(((2.0 + 7.0) - (9.0 + 3.0)))), + test_xy("((2 - x) - (y - 3))",T(7.0),T(9.0),T(((2.0 - 7.0) - (9.0 - 3.0)))), + test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), + test_xy("((x + 2) + (3 + y))",T(7.0),T(9.0),T(((7.0 + 2.0) + (3.0 + 9.0)))), + test_xy("((x + 2) - (3 + y))",T(7.0),T(9.0),T(((7.0 + 2.0) - (3.0 + 9.0)))), + test_xy("((x - 2) - (3 - y))",T(7.0),T(9.0),T(((7.0 - 2.0) - (3.0 - 9.0)))), + test_xy("((2 * x) * (3 * y))",T(7.0),T(9.0),T(((2.0 * 7.0) * (3.0 * 9.0)))), test_xy("0 * (abs (x) + acos (y) + asin (x) + atan (y))",T(1.0),T(1.0),T(0.0)), test_xy("0 * (ceil (x) + cos (y) + cosh (x) + exp (y))",T(1.0),T(1.0),T(0.0)), test_xy("0 * (floor(x) + log (y) + log10(x) + round(y))",T(1.0),T(1.0),T(0.0)), @@ -1331,6 +1380,7 @@ inline bool run_test01() for (std::size_t r = 0; r < rounds; ++r) { + bool loop_result = true; for (std::size_t i = 0; i < test_list_size; ++i) { test_xy& test = const_cast&>(test_list[i]); @@ -1349,7 +1399,8 @@ inline bool run_test01() printf("run_test01() - Error: %s Expression: %s\n", parser.error().c_str(), test.expr.c_str()); - return false; + loop_result = false; + continue; } } @@ -1361,9 +1412,14 @@ inline bool run_test01() test.expr.c_str(), test.result, result); - return false; + loop_result = false; } } + + if (!loop_result) + { + return false; + } } return true; @@ -2073,101 +2129,102 @@ inline bool run_test08() "equal($f01(x,y,z),(x+y)*z)", "equal($f02(x,y,z),(x+y)-z)", "equal($f03(x,y,z),(x+y)+z)", - "equal($f04(x,y,z),(x-y)/z)", - "equal($f05(x,y,z),(x-y)*z)", - "equal($f06(x,y,z),(x*y)+z)", - "equal($f07(x,y,z),(x*y)-z)", - "equal($f08(x,y,z),(x*y)/z)", - "equal($f09(x,y,z),(x*y)*z)", - "equal($f10(x,y,z),(x/y)+z)", - "equal($f11(x,y,z),(x/y)-z)", - "equal($f12(x,y,z),(x/y)/z)", - "equal($f13(x,y,z),(x/y)*z)", - "equal($f14(x,y,z),x/(y+z))", - "equal($f15(x,y,z),x/(y-z))", - "equal($f16(x,y,z),x/(y*z))", - "equal($f17(x,y,z),x/(y/z))", - "equal($f18(x,y,z),x*(y+z))", - "equal($f19(x,y,z),x*(y-z))", - "equal($f20(x,y,z),x*(y*z))", - "equal($f21(x,y,z),x*(y/z))", - "equal($f22(x,y,z),x-(y+z))", - "equal($f23(x,y,z),x-(y-z))", - "equal($f24(x,y,z),x-(y/z))", - "equal($f25(x,y,z),x-(y*z))", - "equal($f26(x,y,z),x+(y*z))", - "equal($f27(x,y,z),x+(y/z))", - "equal($f28(x,y,z),x+(y+z))", - "equal($f29(x,y,z),x+(y-z))", - "equal($f30(x,y,z),x*y^2+z)", - "equal($f31(x,y,z),x*y^3+z)", - "equal($f32(x,y,z),x*y^4+z)", - "equal($f33(x,y,z),x*y^5+z)", - "equal($f34(x,y,z),x*y^6+z)", - "equal($f35(x,y,z),x*y^7+z)", - "equal($f36(x,y,z),x*y^8+z)", - "equal($f37(x,y,z),x*y^9+z)", - "equal($f38(x,y,z),x*log(y)+z)", - "equal($f39(x,y,z),x*log(y)-z)", - "equal($f40(x,y,z),x*log10(y)+z)", - "equal($f41(x,y,z),x*log10(y)-z)", - "equal($f42(x,y,z),x*sin(y)+z)", - "equal($f43(x,y,z),x*sin(y)-z)", - "equal($f44(x,y,z),x*cos(y)+z)", - "equal($f45(x,y,z),x*cos(y)-z)", - "equal($f46(x,y,z),if(0!=x,y,z))", - "equal($f47(x,y,z,w),x+((y+z)/w))", - "equal($f48(x,y,z,w),x+((y+z)*w))", - "equal($f49(x,y,z,w),x+((y-z)/w))", - "equal($f50(x,y,z,w),x+((y-z)*w))", - "equal($f51(x,y,z,w),x+((y*z)/w))", - "equal($f52(x,y,z,w),x+((y*z)*w))", - "equal($f53(x,y,z,w),x+((y/z)+w))", - "equal($f54(x,y,z,w),x+((y/z)/w))", - "equal($f55(x,y,z,w),x+((y/z)*w))", - "equal($f56(x,y,z,w),x-((y+z)/w))", - "equal($f57(x,y,z,w),x-((y+z)*w))", - "equal($f58(x,y,z,w),x-((y-z)/w))", - "equal($f59(x,y,z,w),x-((y-z)*w))", - "equal($f60(x,y,z,w),x-((y*z)/w))", - "equal($f61(x,y,z,w),x-((y*z)*w))", - "equal($f62(x,y,z,w),x-((y/z)/w))", - "equal($f63(x,y,z,w),x-((y/z)*w))", - "equal($f64(x,y,z,w),((x+y)*z)-w)", - "equal($f65(x,y,z,w),((x-y)*z)-w)", - "equal($f66(x,y,z,w),((x*y)*z)-w)", - "equal($f67(x,y,z,w),((x/y)*z)-w)", - "equal($f68(x,y,z,w),((x+y)/z)-w)", - "equal($f69(x,y,z,w),((x-y)/z)-w)", - "equal($f70(x,y,z,w),((x*y)/z)-w)", - "equal($f71(x,y,z,w),((x/y)/z)-w)", - "equal($f72(x,y,z,w),(x*y)+(z*w))", - "equal($f73(x,y,z,w),(x*y)-(z*w))", - "equal($f74(x,y,z,w),(x*y)+(z/w))", - "equal($f75(x,y,z,w),(x*y)-(z/w))", - "equal($f76(x,y,z,w),(x/y)+(z/w))", - "equal($f77(x,y,z,w),(x/y)-(z/w))", - "equal($f78(x,y,z,w),(x/y)-(z*w))", - "equal($f79(x,y,z,w),x/(y+(z*w)))", - "equal($f80(x,y,z,w),x/(y-(z*w)))", - "equal($f81(x,y,z,w),x*(y+(z*w)))", - "equal($f82(x,y,z,w),x*(y-(z*w)))", - "equal($f83(x,y,z,w),x*y^2+z*w^2)", - "equal($f84(x,y,z,w),x*y^3+z*w^3)", - "equal($f85(x,y,z,w),x*y^4+z*w^4)", - "equal($f86(x,y,z,w),x*y^5+z*w^5)", - "equal($f87(x,y,z,w),x*y^6+z*w^6)", - "equal($f88(x,y,z,w),x*y^7+z*w^7)", - "equal($f89(x,y,z,w),x*y^8+z*w^8)", - "equal($f90(x,y,z,w),x*y^9+z*w^9)", - "equal($f91(x,y,z,w),if(x and y,z,w))", - "equal($f92(x,y,z,w),if(x or y,z,w))", - "equal($f93(x,y,z,w),if(x < y,z,w))", - "equal($f94(x,y,z,w),if(x <= y,z,w))", - "equal($f95(x,y,z,w),if(x > y,z,w))", - "equal($f96(x,y,z,w),if(x >= y,z,w))", - "equal($f97(x,y,z,w),if(equal(x,y),z,w))", - "equal($f98(x,y,z,w),x*sin(y)+z*cos(w))" + "equal($f04(x,y,z),(x-y)+z)", + "equal($f05(x,y,z),(x-y)/z)", + "equal($f06(x,y,z),(x-y)*z)", + "equal($f07(x,y,z),(x*y)+z)", + "equal($f08(x,y,z),(x*y)-z)", + "equal($f09(x,y,z),(x*y)/z)", + "equal($f10(x,y,z),(x*y)*z)", + "equal($f11(x,y,z),(x/y)+z)", + "equal($f12(x,y,z),(x/y)-z)", + "equal($f13(x,y,z),(x/y)/z)", + "equal($f14(x,y,z),(x/y)*z)", + "equal($f15(x,y,z),x/(y+z))", + "equal($f16(x,y,z),x/(y-z))", + "equal($f17(x,y,z),x/(y*z))", + "equal($f18(x,y,z),x/(y/z))", + "equal($f19(x,y,z),x*(y+z))", + "equal($f20(x,y,z),x*(y-z))", + "equal($f21(x,y,z),x*(y*z))", + "equal($f22(x,y,z),x*(y/z))", + "equal($f23(x,y,z),x-(y+z))", + "equal($f24(x,y,z),x-(y-z))", + "equal($f25(x,y,z),x-(y/z))", + "equal($f26(x,y,z),x-(y*z))", + "equal($f27(x,y,z),x+(y*z))", + "equal($f28(x,y,z),x+(y/z))", + "equal($f29(x,y,z),x+(y+z))", + "equal($f30(x,y,z),x+(y-z))", + "equal($f31(x,y,z),x*y^2+z)", + "equal($f32(x,y,z),x*y^3+z)", + "equal($f33(x,y,z),x*y^4+z)", + "equal($f34(x,y,z),x*y^5+z)", + "equal($f35(x,y,z),x*y^6+z)", + "equal($f36(x,y,z),x*y^7+z)", + "equal($f37(x,y,z),x*y^8+z)", + "equal($f38(x,y,z),x*y^9+z)", + "equal($f39(x,y,z),x*log(y)+z)", + "equal($f40(x,y,z),x*log(y)-z)", + "equal($f41(x,y,z),x*log10(y)+z)", + "equal($f42(x,y,z),x*log10(y)-z)", + "equal($f43(x,y,z),x*sin(y)+z)", + "equal($f44(x,y,z),x*sin(y)-z)", + "equal($f45(x,y,z),x*cos(y)+z)", + "equal($f46(x,y,z),x*cos(y)-z)", + "equal($f47(x,y,z),if(0!=x,y,z))", + "equal($f48(x,y,z,w),x+((y+z)/w))", + "equal($f49(x,y,z,w),x+((y+z)*w))", + "equal($f50(x,y,z,w),x+((y-z)/w))", + "equal($f51(x,y,z,w),x+((y-z)*w))", + "equal($f52(x,y,z,w),x+((y*z)/w))", + "equal($f53(x,y,z,w),x+((y*z)*w))", + "equal($f54(x,y,z,w),x+((y/z)+w))", + "equal($f55(x,y,z,w),x+((y/z)/w))", + "equal($f56(x,y,z,w),x+((y/z)*w))", + "equal($f57(x,y,z,w),x-((y+z)/w))", + "equal($f58(x,y,z,w),x-((y+z)*w))", + "equal($f59(x,y,z,w),x-((y-z)/w))", + "equal($f60(x,y,z,w),x-((y-z)*w))", + "equal($f61(x,y,z,w),x-((y*z)/w))", + "equal($f62(x,y,z,w),x-((y*z)*w))", + "equal($f63(x,y,z,w),x-((y/z)/w))", + "equal($f64(x,y,z,w),x-((y/z)*w))", + "equal($f65(x,y,z,w),((x+y)*z)-w)", + "equal($f66(x,y,z,w),((x-y)*z)-w)", + "equal($f67(x,y,z,w),((x*y)*z)-w)", + "equal($f68(x,y,z,w),((x/y)*z)-w)", + "equal($f69(x,y,z,w),((x+y)/z)-w)", + "equal($f70(x,y,z,w),((x-y)/z)-w)", + "equal($f71(x,y,z,w),((x*y)/z)-w)", + "equal($f72(x,y,z,w),((x/y)/z)-w)", + "equal($f73(x,y,z,w),(x*y)+(z*w))", + "equal($f74(x,y,z,w),(x*y)-(z*w))", + "equal($f75(x,y,z,w),(x*y)+(z/w))", + "equal($f76(x,y,z,w),(x*y)-(z/w))", + "equal($f77(x,y,z,w),(x/y)+(z/w))", + "equal($f78(x,y,z,w),(x/y)-(z/w))", + "equal($f79(x,y,z,w),(x/y)-(z*w))", + "equal($f80(x,y,z,w),x/(y+(z*w)))", + "equal($f81(x,y,z,w),x/(y-(z*w)))", + "equal($f82(x,y,z,w),x*(y+(z*w)))", + "equal($f83(x,y,z,w),x*(y-(z*w)))", + "equal($f84(x,y,z,w),x*y^2+z*w^2)", + "equal($f85(x,y,z,w),x*y^3+z*w^3)", + "equal($f86(x,y,z,w),x*y^4+z*w^4)", + "equal($f87(x,y,z,w),x*y^5+z*w^5)", + "equal($f88(x,y,z,w),x*y^6+z*w^6)", + "equal($f89(x,y,z,w),x*y^7+z*w^7)", + "equal($f90(x,y,z,w),x*y^8+z*w^8)", + "equal($f91(x,y,z,w),x*y^9+z*w^9)", + "equal($f92(x,y,z,w),if(x and y,z,w))", + "equal($f93(x,y,z,w),if(x or y,z,w))", + "equal($f94(x,y,z,w),if(x < y,z,w))", + "equal($f95(x,y,z,w),if(x <= y,z,w))", + "equal($f96(x,y,z,w),if(x > y,z,w))", + "equal($f97(x,y,z,w),if(x >= y,z,w))", + "equal($f98(x,y,z,w),if(equal(x,y),z,w))", + "equal($f99(x,y,z,w),x*sin(y)+z*cos(w))" }; static const std::size_t expr_str_size = sizeof(expr_str) / sizeof(std::string);