RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.Ln Function

Returns the natural log of a real expression.

Pascal
function Ln(const X: Extended): Extended;
C++
Extended Ln(const Extended X);

System

In Delphi code, Ln returns the natural logarithm (Ln(e) = 1) of the real-type expression X.  

Delphi Examples: 

 

{
This example calculated the exponential of 1.0 and then calculates
the natural log of that quantity to show that the natural log
function is the inverse of the exponential function.
}
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;

 

Exp 

LnXP1

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!