The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



TMathExpression


The class TMathExpression is a mathematical function interpreter which can be used to evaluate mathematical and/or logical terms. In order to use it, you have first to assign the term to be evaluated to the property Expression. After that you can call the method Evaluate to calculate the result of the expression. The expression may contain any number of variables. Logical and numeric expressions may be mixed where appropriate. The numerical/logical values of the variables are requested by the function evaluator by means of the OnVarRequest event.

The class TMathExpression raises an ESDLMathExp exception whenever an invalid state is encountered. Besides the message of the exception its help context gives a hint on the cause of the exception:

Help Context Id Cause of Exception
101undefined variable VARNAME
102operator stack underflow
103variable stack overflow
104invalid argument of arcsin
105invalid argument of arccos
106invalid argument of normal distribution quantile
107invalid argument of logarithm
108invalid argument of logarithm
109invalid argument of square root
110variable stack underflow
111division by zero
112modulo argument must not be zero or negative
113non-integer power of negative number cannot be calculated
114list stack overflow
115unmatched parentheses
116empty expression
117syntax error
118operator stack overflow
119variable stack overflow
120operator stack overflow
121operator stack underflow
122operator stack overflow
123syntax error



Last Update: 2023-Jun-14