Previous: DegToRad function To the Table of Content Next: FahrToCels function

- 4.45.2.26 -
Standard Units
Math Unit
Math Unit Procedures and Functions

Evaluate procedure

Targets: MS-DOS, OS/2, Win32


Math Unit

Evaluates the given expression.

Declaration:
procedure Evaluate(Expr: String;
                    var Result: Extended;
                    var ErrCode: Longint);
Remarks:
Use Evaluate to evaluate any valid expression given in Expr. The Result variable returns the evaluated expression. If it succeeds, the ErrCode variable is 0.

Examples:
uses
  Math, Strings;
const
  Expr = 'cos(0)*(5^2-3.1)';
var
  Result: Extended;
  ErrCode: Longint;
begin
  Evaluate(Expr, Result, ErrCode);
  if ErrCode = 0 then 
    Writeln(Expr, ' = ', Fls(Result))
  else   
    Writeln('Invalid expression');
end.
The example above will print 21.9.


Previous: DegToRad function To the Table of Content Next: FahrToCels function
DegToRad function Table of Content FahrToCels function

- 4.45.2.26 -