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);

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;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!