C++ Mathematical Expression Library (ExprTk) http://www.partow.net/programming/exprtk/index.html
This commit is contained in:
parent
b369bc342c
commit
399a5f9aa3
120
exprtk.hpp
120
exprtk.hpp
|
@ -232,6 +232,12 @@ namespace exprtk
|
|||
return (*this);
|
||||
}
|
||||
|
||||
inline build_string& operator << (const char* s)
|
||||
{
|
||||
data_ += std::string(s);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
inline operator std::string () const
|
||||
{
|
||||
return data_;
|
||||
|
@ -13883,7 +13889,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<vtype,vtype,vtype>(expr_gen,id(expr_gen,o0,o1),v0,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -13920,7 +13926,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<vtype,vtype,ctype>(expr_gen,id(expr_gen,o0,o1),v0,v1,c,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -13956,7 +13962,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<vtype,vtype,ctype>(expr_gen,id(expr_gen,o0,o1),v0,v1,c,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -13992,7 +13998,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<vtype,ctype,vtype>(expr_gen,id(expr_gen,o0,o1),v0,c,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14028,7 +14034,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<vtype,ctype,vtype>(expr_gen,id(expr_gen,o0,o1),v0,c,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14064,7 +14070,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<ctype,vtype,vtype>(expr_gen,id(expr_gen,o0,o1),c,v0,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14101,7 +14107,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<ctype,vtype,vtype>(expr_gen,id(expr_gen,o0,o1),c,v0,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14137,7 +14143,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<ctype,vtype,ctype>(expr_gen,id(expr_gen,o0,o1),c0,v,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14174,7 +14180,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<ctype,vtype,ctype>(expr_gen,id(expr_gen,o0,o1),c0,v,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14221,7 +14227,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<ctype,ctype,vtype>(expr_gen,id(expr_gen,o0,o1),c0,c1,v,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14257,7 +14263,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf3ext_expression::template compile<vtype,ctype,ctype>(expr_gen,id(expr_gen,o0,o1),v,c0,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14313,7 +14319,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,v3,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14359,7 +14365,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,c,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14406,7 +14412,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,c,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14453,7 +14459,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14500,7 +14506,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c,v0,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14547,7 +14553,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,c1,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14594,7 +14600,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14641,7 +14647,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14688,7 +14694,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,c1,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else if (!expr_gen.valid_operator(o1,f1))
|
||||
return error_node();
|
||||
|
@ -14734,7 +14740,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,v3,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,v3,f0,f1,f2);
|
||||
|
@ -14776,7 +14782,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,c,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,c,f0,f1,f2);
|
||||
|
@ -14847,7 +14853,7 @@ namespace exprtk
|
|||
typedef typename synthesize_covov_expression1::node_type covov_t;
|
||||
const covov_t* covov = dynamic_cast<const covov_t*>(branch[1]);
|
||||
const T& v0 = dynamic_cast<details::variable_node<Type>*>(branch[0])->ref();
|
||||
const T& c = covov->t0();
|
||||
const T c = covov->t0();
|
||||
const T& v1 = covov->t1();
|
||||
const T& v2 = covov->t2();
|
||||
const details::operator_type o0 = operation;
|
||||
|
@ -14860,7 +14866,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c,v1,v2,f0,f1,f2);
|
||||
|
@ -14888,7 +14894,7 @@ namespace exprtk
|
|||
// c o0 (v0 o1 (v1 o2 v2))
|
||||
typedef typename synthesize_vovov_expression1::node_type vovov_t;
|
||||
const vovov_t* vovov = dynamic_cast<const vovov_t*>(branch[1]);
|
||||
const T& c = dynamic_cast<details::literal_node<Type>*>(branch[0])->value();
|
||||
const T c = dynamic_cast<details::literal_node<Type>*>(branch[0])->value();
|
||||
const T& v0 = vovov->t0();
|
||||
const T& v1 = vovov->t1();
|
||||
const T& v2 = vovov->t2();
|
||||
|
@ -14946,7 +14952,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,c1,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c0,v0,c1,v1,f0,f1,f2);
|
||||
|
@ -14988,7 +14994,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c0,v1,c1,f0,f1,f2);
|
||||
|
@ -15031,7 +15037,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c0,v0,v1,c1,f0,f1,f2);
|
||||
|
@ -15073,7 +15079,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,c1,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c0,c1,v1,f0,f1,f2);
|
||||
|
@ -15115,7 +15121,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,v3,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,v3,f0,f1,f2);
|
||||
|
@ -15157,7 +15163,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,c,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,c,f0,f1,f2);
|
||||
|
@ -15199,7 +15205,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,c,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,c,v2,f0,f1,f2);
|
||||
|
@ -15241,7 +15247,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c,v1,v2,f0,f1,f2);
|
||||
|
@ -15284,7 +15290,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c,v0,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c,v0,v1,v2,f0,f1,f2);
|
||||
|
@ -15327,7 +15333,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,c1,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c0,v0,c1,v1,f0,f1,f2);
|
||||
|
@ -15356,9 +15362,9 @@ namespace exprtk
|
|||
typedef typename synthesize_covoc_expression0::node_type covoc_t;
|
||||
const covoc_t* covoc = dynamic_cast<const covoc_t*>(branch[1]);
|
||||
const T& v0 = dynamic_cast<details::variable_node<Type>*>(branch[0])->ref();
|
||||
const T& c0 = covoc->t0();
|
||||
const T c0 = covoc->t0();
|
||||
const T& v1 = covoc->t1();
|
||||
const T& c1 = covoc->t2();
|
||||
const T c1 = covoc->t2();
|
||||
const details::operator_type o0 = operation;
|
||||
const details::operator_type o1 = expr_gen.get_operator(covoc->f0());
|
||||
const details::operator_type o2 = expr_gen.get_operator(covoc->f1());
|
||||
|
@ -15369,7 +15375,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c0,v1,c1,f0,f1,f2);
|
||||
|
@ -15412,7 +15418,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o0,f0))
|
||||
else if (!expr_gen.valid_operator(o0,f0))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c0,v0,v1,c1,f0,f1,f2);
|
||||
|
@ -15470,7 +15476,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,v3,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,v3,f0,f1,f2);
|
||||
|
@ -15513,7 +15519,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,c,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,c,f0,f1,f2);
|
||||
|
@ -15555,7 +15561,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,c,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,c,v2,f0,f1,f2);
|
||||
|
@ -15584,7 +15590,7 @@ namespace exprtk
|
|||
typedef typename synthesize_vocov_expression0::node_type vocov_t;
|
||||
const vocov_t* vocov = dynamic_cast<const vocov_t*>(branch[0]);
|
||||
const T& v0 = vocov->t0();
|
||||
const T& c = vocov->t1();
|
||||
const T c = vocov->t1();
|
||||
const T& v1 = vocov->t2();
|
||||
const T& v2 = dynamic_cast<details::variable_node<Type>*>(branch[1])->ref();
|
||||
const details::operator_type o0 = expr_gen.get_operator(vocov->f0());
|
||||
|
@ -15597,7 +15603,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c,v1,v2,f0,f1,f2);
|
||||
|
@ -15639,7 +15645,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c,v0,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c,v0,v1,v2,f0,f1,f2);
|
||||
|
@ -15681,7 +15687,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,c1,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c0,v0,c1,v1,f0,f1,f2);
|
||||
|
@ -15724,7 +15730,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c0,v1,c1,f0,f1,f2);
|
||||
|
@ -15767,7 +15773,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c0,v0,v1,c1,f0,f1,f2);
|
||||
|
@ -15809,7 +15815,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,c1,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c0,c1,v1,f0,f1,f2);
|
||||
|
@ -15851,7 +15857,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,v3,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,v3,f0,f1,f2);
|
||||
|
@ -15894,7 +15900,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,v2,c,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,v2,c,f0,f1,f2);
|
||||
|
@ -15936,7 +15942,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,v1,c,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,v1,c,v2,f0,f1,f2);
|
||||
|
@ -15978,7 +15984,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c,v1,v2,f0,f1,f2);
|
||||
|
@ -16020,7 +16026,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c,v0,v1,v2,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c,v0,v1,v2,f0,f1,f2);
|
||||
|
@ -16062,7 +16068,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,c1,v1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c0,v0,c1,v1,f0,f1,f2);
|
||||
|
@ -16105,7 +16111,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),v0,c0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),v0,c0,v1,c1,f0,f1,f2);
|
||||
|
@ -16148,7 +16154,7 @@ namespace exprtk
|
|||
expression_node_ptr result = error_node();
|
||||
if (synthesize_sf4ext_expression::template compile<T0,T1,T2,T3>(expr_gen,id(expr_gen,o0,o1,o2),c0,v0,v1,c1,result))
|
||||
return result;
|
||||
if (!expr_gen.valid_operator(o2,f2))
|
||||
else if (!expr_gen.valid_operator(o2,f2))
|
||||
return error_node();
|
||||
else
|
||||
return node_type::allocate(*(expr_gen.node_allocator_),c0,v0,v1,c1,f0,f1,f2);
|
||||
|
|
|
@ -82,7 +82,7 @@ void run_exprtk_benchmark(T& x, T& y,
|
|||
exprtk::expression<T>& expression,
|
||||
const std::string& expr_string)
|
||||
{
|
||||
T total = 0.0;
|
||||
T total = T(0);
|
||||
unsigned int count = 0;
|
||||
exprtk::timer timer;
|
||||
timer.start();
|
||||
|
@ -95,7 +95,7 @@ void run_exprtk_benchmark(T& x, T& y,
|
|||
}
|
||||
}
|
||||
timer.stop();
|
||||
if (T(0.0) != total)
|
||||
if (T(0) != total)
|
||||
printf("[exprtk] Total Time:%12.8f Rate:%14.3fevals/sec Expression: %s\n",
|
||||
timer.time(),
|
||||
count / timer.time(),
|
||||
|
@ -109,7 +109,7 @@ template <typename T> struct native;
|
|||
template <typename T, typename NativeFunction>
|
||||
void run_native_benchmark(T& x, T& y, NativeFunction f, const std::string& expr_string)
|
||||
{
|
||||
T total = 0.0;
|
||||
T total = T(0);
|
||||
unsigned int count = 0;
|
||||
exprtk::timer timer;
|
||||
timer.start();
|
||||
|
@ -122,7 +122,7 @@ void run_native_benchmark(T& x, T& y, NativeFunction f, const std::string& expr_
|
|||
}
|
||||
}
|
||||
timer.stop();
|
||||
if (T(0.0) != total)
|
||||
if (T(0) != total)
|
||||
printf("[native] Total Time:%12.8f Rate:%14.3fevals/sec Expression: %s\n",
|
||||
timer.time(),
|
||||
count / timer.time(),
|
||||
|
@ -173,7 +173,7 @@ struct native
|
|||
|
||||
static inline T avg(Type x, Type y)
|
||||
{
|
||||
return (x + y) / T(2.0);
|
||||
return (x + y) / T(2);
|
||||
}
|
||||
|
||||
static inline T clamp(const Type l, const Type v, const Type u)
|
||||
|
@ -188,12 +188,12 @@ struct native
|
|||
|
||||
static inline T func01(Type x, Type y)
|
||||
{
|
||||
return T(2.0) * (y + x);
|
||||
return T(2) * (y + x);
|
||||
}
|
||||
|
||||
static inline T func02(Type x, Type y)
|
||||
{
|
||||
return (T(2.0) * y + T(2.0) * x);
|
||||
return (T(2) * y + T(2) * x);
|
||||
}
|
||||
|
||||
static inline T func03(Type x, Type y)
|
||||
|
@ -213,7 +213,7 @@ struct native
|
|||
|
||||
static inline T func06(Type x, Type y)
|
||||
{
|
||||
return T(1.0) - ((x * y) + (y / x)) - T(3.0);
|
||||
return T(1) - ((x * y) + (y / x)) - T(3);
|
||||
}
|
||||
|
||||
static inline T func07(Type x, Type y)
|
||||
|
@ -223,27 +223,28 @@ struct native
|
|||
|
||||
static inline T func08(Type x, Type y)
|
||||
{
|
||||
return (1.1*pow(x,T(1.0))+2.2*pow(y,T(2.0))-3.3*pow(x,T(3.0))+4.4*pow(y,T(15.0))-5.5*pow(x,T(23.0))+6.6*pow(y,T(55.0)));
|
||||
using namespace std;
|
||||
return (T(1.1)*pow(x,T(1))+T(2.2)*pow(y,T(2))-T(3.3)*pow(x,T(3))+T(4.4)*pow(y,T(15))-T(5.5)*pow(x,T(23))+T(6.6)*pow(y,T(55)));
|
||||
}
|
||||
|
||||
static inline T func09(Type x, Type y)
|
||||
{
|
||||
return std::sin(T(2.0) * x) + std::cos(pi / y);
|
||||
return std::sin(T(2) * x) + std::cos(pi / y);
|
||||
}
|
||||
|
||||
static inline T func10(Type x, Type y)
|
||||
{
|
||||
return T(1.0) - std::sin(2.0 * x) + std::cos(pi / y);
|
||||
return T(1) - std::sin(T(2) * x) + std::cos(pi / y);
|
||||
}
|
||||
|
||||
static inline T func11(Type x, Type y)
|
||||
{
|
||||
return std::sqrt(T(111.111) - std::sin(T(2.0) * x) + std::cos(pi / y) / T(333.333));
|
||||
return std::sqrt(T(111.111) - std::sin(T(2) * x) + std::cos(pi / y) / T(333.333));
|
||||
}
|
||||
|
||||
static inline T func12(Type x, Type y)
|
||||
{
|
||||
return ((x * x) / std::sin(T(2.0) * pi / y)) -x / T(2.0);
|
||||
return ((x * x) / std::sin(T(2) * pi / y)) - x / T(2);
|
||||
}
|
||||
|
||||
static inline T func13(Type x, Type y)
|
||||
|
@ -253,17 +254,17 @@ struct native
|
|||
|
||||
static inline T func14(Type x, Type y)
|
||||
{
|
||||
return clamp(T(-1.0), std::sin(T(2.0) * pi * x) + std::cos(y / T(2.0) * pi), + T(1.0));
|
||||
return clamp(T(-1), std::sin(T(2) * pi * x) + std::cos(y / T(2) * pi), + T(1));
|
||||
}
|
||||
|
||||
static inline T func15(Type x, Type y)
|
||||
{
|
||||
return std::max(T(3.33), std::min(sqrt(T(1.0) - std::sin(T(2.0) * x) + std::cos(pi / y) / T(3.0)), T(1.11)));
|
||||
return std::max(T(3.33), std::min(sqrt(T(1) - std::sin(T(2) * x) + std::cos(pi / y) / T(3)), T(1.11)));
|
||||
}
|
||||
|
||||
static inline T func16(Type x, Type y)
|
||||
{
|
||||
return (((y + (x * T(2.2))) <= (x + y + T(1.1))) ? x - y : x * y) + T(2.0) * pi / x;
|
||||
return (((y + (x * T(2.2))) <= (x + y + T(1.1))) ? x - y : x * y) + T(2) * pi / x;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ void square_wave()
|
|||
" (1/21)*sin(42*pi*f*t)+(1/23)*sin(46*pi*f*t)+"
|
||||
" (1/25)*sin(50*pi*f*t)+(1/27)*sin(54*pi*f*t))";
|
||||
static const T pi = T(3.14159265358979323846);
|
||||
T f = pi/10.0;
|
||||
T t = T(0.0);
|
||||
T a = T(10.0);
|
||||
T f = pi / T(10);
|
||||
T t = T(0);
|
||||
T a = T(10);
|
||||
|
||||
exprtk::symbol_table<T> symbol_table;
|
||||
symbol_table.add_variable("f",f);
|
||||
|
@ -49,8 +49,8 @@ void square_wave()
|
|||
exprtk::parser<T> parser;
|
||||
parser.compile(expr_string,expression);
|
||||
|
||||
const T delta = (4.0*pi)/1000.0;
|
||||
for (t = -2.0*pi; t <= +2.0*pi; t+=delta)
|
||||
const T delta = (T(4) * pi) / T(1000);
|
||||
for (t = (T(-2) * pi); t <= (T(+2) * pi); t += delta)
|
||||
{
|
||||
T result = expression.value();
|
||||
printf("%19.15f\t%19.15f\n",t,result);
|
||||
|
|
|
@ -25,9 +25,9 @@ template<typename T>
|
|||
void polynomial()
|
||||
{
|
||||
std::string expression_string = "25x^5 - 35x^4 - 15x^3 + 40x^2 - 15x + 1";
|
||||
T r0 = T(0.0);
|
||||
T r1 = T(1.0);
|
||||
T x = T(0.0);
|
||||
T r0 = T(0);
|
||||
T r1 = T(1);
|
||||
T x = T(0);
|
||||
|
||||
exprtk::symbol_table<T> symbol_table;
|
||||
symbol_table.add_variable("x",x);
|
||||
|
|
|
@ -39,8 +39,8 @@ void custom_function()
|
|||
{
|
||||
typedef exprtk::expression<T> expression_t;
|
||||
std::string expression_string = "myfunc(sin(x*pi),y/2)";
|
||||
T x = T(1.0);
|
||||
T y = T(2.0);
|
||||
T x = T(1);
|
||||
T y = T(2);
|
||||
myfunc<T> mf;
|
||||
|
||||
exprtk::symbol_table<T> symbol_table;
|
||||
|
|
|
@ -1008,7 +1008,7 @@ inline bool not_equal_impl(const T& t1,
|
|||
if (t1 != t1) return true;
|
||||
if (t2 != t2) return true;
|
||||
T diff = std::abs(t1 - t2);
|
||||
T eps_norm = (std::max(T(1.0),std::max(std::abs(t1),std::abs(t2))) * epsilon);
|
||||
T eps_norm = (std::max(T(1),std::max(std::abs(t1),std::abs(t2))) * epsilon);
|
||||
return diff > eps_norm;
|
||||
}
|
||||
|
||||
|
|
94
readme.txt
94
readme.txt
|
@ -134,9 +134,6 @@ include path (e.g: /usr/include/).
|
|||
| := | Assign the value of x to y. (eg: y := x) |
|
||||
| | Where y is a variable type. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| <=> | Swap the values of x and y. (eg: x <=> y) |
|
||||
| | Where both x and y are variables. |
|
||||
+----------+---------------------------------------------------------+
|
||||
|
||||
(1) Equalities & Inequalities
|
||||
+----------+---------------------------------------------------------+
|
||||
|
@ -144,7 +141,7 @@ include path (e.g: /usr/include/).
|
|||
+----------+---------------------------------------------------------+
|
||||
| == or = | True only if x is strictly equal to y. (eg: x == y) |
|
||||
+----------+---------------------------------------------------------+
|
||||
| <> or != | True only if x does not equal y (eg: x <> y or x != y) |
|
||||
| <> or != | True only if x does not equal y. (eg: x <> y or x != y) |
|
||||
+----------+---------------------------------------------------------+
|
||||
| < | True only if x is less than y. (eg: x < y) |
|
||||
+----------+---------------------------------------------------------+
|
||||
|
@ -152,7 +149,7 @@ include path (e.g: /usr/include/).
|
|||
+----------+---------------------------------------------------------+
|
||||
| > | True only if x is greater than y. (eg: x > y) |
|
||||
+----------+---------------------------------------------------------+
|
||||
| >= | True only if x greater than or equal to y (eg: x >= y) |
|
||||
| >= | True only if x greater than or equal to y. (eg: x >= y) |
|
||||
+----------+---------------------------------------------------------+
|
||||
|
||||
(2) Boolean Operations
|
||||
|
@ -214,29 +211,29 @@ include path (e.g: /usr/include/).
|
|||
+----------+---------------------------------------------------------+
|
||||
| equal | Equality test between x and y using normalized epsilon |
|
||||
+----------+---------------------------------------------------------+
|
||||
| erf | Error function of x |
|
||||
| erf | Error function of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| erfc | Complimentary error function of x |
|
||||
| erfc | Complimentary error function of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| exp | e to the power of x |
|
||||
| exp | e to the power of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| expm1 | e to the power of x minus 1, where x is very small. |
|
||||
| | (eg: expm1(x)) |
|
||||
+----------+---------------------------------------------------------+
|
||||
| floor | Largest integer that is less than or equal to x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| frac | Fractional portion of x |
|
||||
| frac | Fractional portion of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| hypot | Hypotenuse of x and y (eg: hypot(x,y) = sqrt(x*x + y*y))|
|
||||
+----------+---------------------------------------------------------+
|
||||
| log | Natural logarithm of x |
|
||||
| log | Natural logarithm of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| log10 | Base 10 logarithm of x |
|
||||
| log10 | Base 10 logarithm of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| log1p | Natural logarithm of 1 + x, where x is very small. |
|
||||
| | (eg: log1p(x)) |
|
||||
+----------+---------------------------------------------------------+
|
||||
| log2 | Base 2 logarithm of x |
|
||||
| log2 | Base 2 logarithm of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| logn | Base N logarithm of x (eg: logn(1235,8)) |
|
||||
| | where n > 0 and is an integer. |
|
||||
|
@ -266,7 +263,7 @@ include path (e.g: /usr/include/).
|
|||
| sum | Sum of all the inputs. |
|
||||
| | (eg: sum(x,y,z,w,u,v,t) == (x + y + z + w + u + v + t)) |
|
||||
+----------+---------------------------------------------------------+
|
||||
| trunc | Integer portion of x |
|
||||
| trunc | Integer portion of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
|
||||
(4) Trigonometry Functions
|
||||
|
@ -282,38 +279,38 @@ include path (e.g: /usr/include/).
|
|||
| atan2 | Arc tangent of (x/y) expressed in radians. [-pi,+pi] |
|
||||
| | eg: atan2(x,y) |
|
||||
+----------+---------------------------------------------------------+
|
||||
| cos | Cosine of x |
|
||||
| cos | Cosine of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| cosh | Hyperbolic cosine of x |
|
||||
| cosh | Hyperbolic cosine of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| cot | Cotangent of x |
|
||||
| cot | Cotangent of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| csc | Cosecant of x |
|
||||
| csc | Cosecant of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| sec | Secant of x |
|
||||
| sec | Secant of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| sin | Sine of x |
|
||||
| sin | Sine of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| sinh | Hyperbolic sine of x |
|
||||
| sinh | Hyperbolic sine of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| tan | Tangent of x |
|
||||
| tan | Tangent of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| tanh | Hyperbolic tangent of x |
|
||||
| tanh | Hyperbolic tangent of x. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| deg2rad | Convert x from degrees to radians |
|
||||
| deg2rad | Convert x from degrees to radians. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| deg2grad | Convert x from degrees to gradians |
|
||||
| deg2grad | Convert x from degrees to gradians. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| rad2deg | Convert x from radians to degrees |
|
||||
| rad2deg | Convert x from radians to degrees. |
|
||||
+----------+---------------------------------------------------------+
|
||||
| grad2deg | Convert x from gradians to degrees |
|
||||
| grad2deg | Convert x from gradians to degrees. |
|
||||
+----------+---------------------------------------------------------+
|
||||
|
||||
(5) String Processing
|
||||
+----------+---------------------------------------------------------+
|
||||
| FUNCTION | DEFINITION |
|
||||
+----------+---------------------------------------------------------+
|
||||
| in | True only if x is a substring of y |
|
||||
| in | True only if x is a substring of y. |
|
||||
| | (eg: x in y or 'abc' in 'abcdefgh') |
|
||||
+----------+---------------------------------------------------------+
|
||||
| like | True only if the string x matches the pattern y. |
|
||||
|
@ -471,59 +468,64 @@ correctly optimize such expressions for a given architecture.
|
|||
|
||||
(02) Standard mathematical operator precedence is applied (BEDMAS).
|
||||
|
||||
(03) Supported user defined types are numeric and string variables
|
||||
(03) Results of expressions that are deemed as being 'valid' are to
|
||||
exist within the set of Real numbers. All other results will be
|
||||
of the value Not-A-Number (NaN).
|
||||
|
||||
(04) Supported user defined types are numeric and string variables
|
||||
and functions.
|
||||
|
||||
(04) All variable and function names are case-insensitive
|
||||
(05) All variable and function names are case-insensitive.
|
||||
|
||||
(05) Variable and function names must begin with a letter
|
||||
(06) Variable and function names must begin with a letter
|
||||
(A-Z or a-z), then can be comprised of any combination of
|
||||
letters, digits and underscores. (eg: x, var1 or power_func99)
|
||||
|
||||
(06) Expression lengths and sub-expression lists are limited only by
|
||||
(07) Expression lengths and sub-expression lists are limited only by
|
||||
storage capacity.
|
||||
|
||||
(07) The life-time of objects registered with or created from a
|
||||
specific symbol-table must span at least the life-time of
|
||||
expressions generated using that symbol-table, otherwise
|
||||
the result will be undefined behavior.
|
||||
(08) The life-time of objects registered with or created from a
|
||||
specific symbol-table must span at least the life-time of the
|
||||
compiled expressions which utilize objects, such as variables,
|
||||
of that symbol-table, otherwise the result will be undefined
|
||||
behavior.
|
||||
|
||||
(08) Equal/Nequal are normalized equality routines, which use
|
||||
(09) Equal/Nequal are normalized equality routines, which use
|
||||
epsilons of 0.0000000001 and 0.000001 for double and float
|
||||
types respectively.
|
||||
|
||||
(09) All trigonometric functions assume radian input unless
|
||||
(10) All trigonometric functions assume radian input unless
|
||||
stated otherwise.
|
||||
|
||||
(10) Expressions may contain white-space characters such as
|
||||
(11) Expressions may contain white-space characters such as
|
||||
space, tabs, new-lines, control-feed et al.
|
||||
('\n', '\r', '\t', '\b', '\v', '\f')
|
||||
|
||||
(11) Strings may be constructed from any letters, digits or special
|
||||
(12) Strings may be constructed from any letters, digits or special
|
||||
characters such as (~!@#$%^&*()[]|=+ ,./?<>;:"`~_), and must
|
||||
be enclosed with single-quotes.
|
||||
eg: 'Frankly, my dear, I do not give a damn!'
|
||||
|
||||
(12) User defined normal functions can have up to 20 parameters,
|
||||
(13) User defined normal functions can have up to 20 parameters,
|
||||
where as user defined vararg-functions can have an unlimited
|
||||
number of parameters.
|
||||
|
||||
(13) The inbuilt polynomial functions can be at most of degree 12.
|
||||
(14) The inbuilt polynomial functions can be at most of degree 12.
|
||||
|
||||
(14) Where appropriate constant folding optimisations will be
|
||||
(15) Where appropriate constant folding optimisations will be
|
||||
applied. (eg: The expression '2+(3-(x/y))' becomes '5-(x/y)')
|
||||
|
||||
(15) String processing capabilities are available by default.
|
||||
(16) String processing capabilities are available by default.
|
||||
To turn them off, the following needs to be defined at
|
||||
compile time: exprtk_disable_string_capabilities
|
||||
|
||||
(16) Composited functions can call themselves or any other functions
|
||||
(17) Composited functions can call themselves or any other functions
|
||||
that have been defined prior to their own definition.
|
||||
|
||||
(17) Recursive calls made from within composited functions will have
|
||||
(18) Recursive calls made from within composited functions will have
|
||||
a stack size bound by the stack of the executing architecture.
|
||||
|
||||
(18) Expressions may contain any of the following comment styles:
|
||||
(19) Expressions may contain any of the following comment styles:
|
||||
1. // .... \n
|
||||
2. # .... \n
|
||||
3. /* .... */
|
||||
|
|
Loading…
Reference in New Issue