SmartPascal
Exp
Function
Gives the exponent of a number System unit
 function Exp ( Number : Extended ) : Extended;
Description
The Exp function takes an integer or floating point Number and raises e (2.72) to that power.
 
This is only used for mathematical processing.
 
Exp has the opposite effect to Ln - the natural logarithm.
Related commands
Ln Gives the natural logarithm of a number
Log10 Gives the log to base 10 of a number
 
Example code : Calculate the exponent of 2
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  // The System unit does not need to be defined
  SysUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  float : Double;
begin
  // Get the natural logarithm of 2
  float := Ln(2);

  // Show this value
  ShowMessage('Ln(2) = '+FloatToStr(float));

  // Get the exponent of this value - reverses the Ln operation
  float := Exp(float);

  // Show this value
  ShowMessage('Exp(Ln(2)) = '+FloatToStr(float));
end;
 
end.
Hide full unit code
   Ln(2) = 0.693147180559945
   Exp(Ln(2)) = 2