| FormulaParserLib_SetFormula | The function sets formula expression to parse. |
| FormulaParserLib_IsValid | The function checks formula expression validity. |
| FormulaParserLib_Parse | The function makes parsing of formula. |
| FormulaParserLib_GetStatementNumber | The function gets number of statements for the formula. |
| FormulaParserLib_GetStatement | The function gets formula statements information. |
| abs(x) | absolute value |
| acos(x) | arccosine |
| asin(x) | arcsine |
| atan(x) | arctangent |
| atan2(y,x) | arctangent y/x |
| ceil(x) | ceiling (the smallest integer that is greater than or equal to x) |
| cos(x) | cosine |
| cosh(x) | hyperbolic cosine |
| div(x,y) | integer quotient from division x/y |
| exp(x) | exponential |
| floor(x) | floor (the largest integer that is less than or equal to x) |
| mod(x,y) | integer remainder from division x/y |
| hypot(x,y) | length of the hypotenuse of a right triangle, given the length of the two sides x and y. Equivalent to the square root of x2 + y2 |
| log(x) | natural logarithm |
| log10(x) | base-10 logarithm |
| max(x,y) | maximal of 2 arguments |
| min(x,y) | minimal of 2 arguments |
| pow(x,y) | x raised to the power of y |
| sin(x) | sine |
| sinh(x) | hyperbolic sine |
| sqrt(x) | square root |
| tan(x) | tangent |
| tanh(x) | hyperbolic tangent |
char formula_str[1000]="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str))
{
//error handling
}
Example 2:
CString formula_str="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str.GetBuffer(1000)))
{
//error handling
}
char formula_str[1000]="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str))
{
//error handling
}
if(!FormulaParserLib_IsValid(NULL)
{
//error handling
}
Example 2:
CString formula_str="sqrt(5+min(a,b))";
if(!FormulaParserLib_IsValid(formula_str.GetBuffer(1000)))
{
//error handling
}
char formula_str[1000]="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str))
{
//error handling
}
if(!FormulaParserLib_IsValid(NULL)
{
//error handling
}
if(!FormulaParserLib_Parse())
{
//error handling
}
Example 2:
CString formula_str="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str.GetBuffer(1000)))
{
//error handling
}
if(!FormulaParserLib_IsValid(NULL)
{
//error handling
}
if(!FormulaParserLib_Parse())
{
//error handling
}
char formula_str[1000]="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str))
{
//error handling
}
if(!FormulaParserLib_IsValid(NULL)
{
//error handling
}
if(!FormulaParserLib_Parse())
{
//error handling
}
long num;
if(!FormulaParserLib_GetStatementNumber(&num))
{
//error handling
}
Example 2:
CString formula_str="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str.GetBuffer(1000)))
{
//error handling
}
if(!FormulaParserLib_IsValid(NULL)
{
//error handling
}
if(!FormulaParserLib_Parse())
{
//error handling
}
long num;
if(!FormulaParserLib_GetStatementNumber(&num))
{
//error handling
}
| Result0=a+b | num=0, arg1="a", arg2="b", oper="+", funct="", res="Result0" |
| Result1=c*d | num=1, arg1="c", arg2="d", oper="*", funct="", res="Result1" |
| Result2=sqrt(e) | num=2, arg1="e", arg2="", oper="", funct="sqrt", res="Result2" |
| Result3=Result1/Result2 | num=3, arg1="Result1", arg2="Result2", oper="/", funct="", res="Result3" |
| Result4=Result0-Result3 | num=4, arg1="Result0", arg2="Result3", oper="-", funct="", res="Result4" |
Example 1:
char formula_str[1000]="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str))
{
//error handling
}
if(!FormulaParserLib_IsValid(NULL)
{
//error handling
}
if(!FormulaParserLib_Parse())
{
//error handling
}
long num;
if(!FormulaParserLib_GetStatementNumber(&num))
{
//error handling
}
char arg1[1000],arg2[1000],oper[1000],funct[1000],res[1000];
for(long i=0;i<num;i++)
{
if(!FormulaParserLib_GetStatement(i,arg1,arg2,oper,funct,res))
{
//error handling
}
}
Example 2:
CString formula_str="sqrt(5+min(a,b))";
if(!FormulaParserLib_SetFormula(formula_str.GetBuffer(1000)))
{
//error handling
}
if(!FormulaParserLib_IsValid(NULL)
{
//error handling
}
if(!FormulaParserLib_Parse())
{
//error handling
}
long num;
if(!FormulaParserLib_GetStatementNumber(&num))
{
//error handling
}
CString arg1,arg2,oper,funct,res;
for(long i=0;i<num;i++)
{
if(!FormulaParserLib_GetStatement(i,arg1.GetBuffer(1000),arg2.GetBuffer(1000),oper.GetBuffer(1000),
funct.GetBuffer(1000),res.GetBuffer(1000)))
{
//error handling
}
arg1.ReleaseBuffer();
arg2.ReleaseBuffer();
oper.ReleaseBuffer();
funct.ReleaseBuffer();
res.ReleaseBuffer();
}