SystemExp (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example calculates the exponential of 1.0 and then calculates the natural log of that quantity in order to show that the natural log function is the inverse of the exponential function.

Code

procedure TForm1.Button1Click(Sender: TObject);
var
   e : real;
   S : string;
begin
   e := Exp(1.0);
   Str(ln(e):3:2, S);
   S := 'e = ' + FloatToStr(e) + '; ln(e) = ' + S;
   Canvas.TextOut(10, 10, S);
end;

Uses