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
Arguments:
Arguments may be variable names or numbers with or without decimal point and sign.
Names may start only with literal character (A..Z, a..z) and may contain literal characters, digits and underscore '_' inside.
The following names are correct:
a
image1
arg_5
s2p6d4
The following names are incorrect:
2arg (starting with number)
arg-27 (contains non-literal symbol)
param$ (contains non-literal symbol)
Numbers may start from sign, point or digit and may contain only digits.
If the function succeeds, the return value is TRUE. Otherwise, the return value is FALSE.
Remarks:
Use the function calculate the formula. If argument list is empty (arg_list[0] is 0) then the
formula calculated successfully and there are no undefined variables found. Otherwise argument list contains list
of undefined variables (arguments), separated by comma (',') and double_res is always 0.
Example
char formula_str[1000]="sqrt(5+min(a,b))";
if(!FormulaCalculatorLib_SetFormula(formula_str))
{
//error handling
}
double res;
char arg_list[1000];
if(!FormulaCalculatorLib_Calculate(&res,arg_list)
{
//error handling
}
if(arg_list[0])
{
//arg_list contains argument list, separated by comma. For this example - "a,b"
//define arguments using FormulaCalculatorLib_AddArgument, then call FormulaCalculatorLib_Calculate again
}