Home  |  Delphi .net Home  |  System.Math  |  Log Method
Log  
Method  
Gives the Logarithm of a number
Math Class
System NameSpace
CF1.  Function Log ( Value : Double; ) : Double;
CF2.  Function Log ( Value:DoubleValue : Double; Base : Double; ) : Double; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns the Natural Logarithm (that is, to base E) of Value, or the logarithm to the given Base.
Notes
Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System
System.Math
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  result : Double;
begin
  // Log of 10 in base E = 2.30258509299405
  result := System.Math.Log(10);
  Console.WriteLine('Log(10)    = {0}', result.ToString);

  // Log of E cubed in base E = 3
  result := System.Math.Log(Math.E * Math.E * Math.E);
  Console.WriteLine('Log(E**3)  = {0}', result.ToString);

  // Log of 25 in base 5 = 2 (5 ** 2 = 25)
  result := System.Math.Log(25, 5);
  Console.WriteLine('Log(25, 5) = {0}', result.ToString);

  Console.ReadLine;
end.
Show full unit code
  Log(10)    = 2.30258509299405
  Log(E**3)  = 3
  Log(25, 5) = 2
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author