From Clomosy Docs

No edit summary
No edit summary
Line 1: Line 1:
function Ln(Number Extended):Extended;
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function Ln(const X: Extended): Extended;
</div>


The Ln function takes an integer or floating point Number and gives the natural logarithm of that number. This is only used for mathematical processing.<br>
The Ln function takes an integer or floating point Number and gives the natural logarithm of that number. This is only used for mathematical processing.<br>
Line 5: Line 7:
Ln has the opposite effect to Exp - the exponent of a number.<br>
Ln has the opposite effect to Exp - the exponent of a number.<br>


'''Example:'''<br>
<b>Example</b><br>
:'''Base Syntax'''
<b>TRObject Syntax</b><br>
  var
<pre>
    float,number : float;
var
 
    float,number : float;
  begin
 
{
    number := 2.14;
    float := '''Ln'''(number);
  number = 2.14;
    ShowMessage('Ln('+FloatToStr(number)+') = '+FloatToStr(float));
  float = Ln(number);
 
  ShowMessage('Ln('+FloatToStr(number)+') = '+FloatToStr(float));
    float := Exp(float);
    ShowMessage('Exp(Ln('+FloatToStr(float)+')) = '+FloatToStr(float));
  float = Exp(float);
  end;
  ShowMessage('Exp(Ln('+FloatToStr(float)+')) = '+FloatToStr(float));
 
}
:'''TRObject Syntax'''
</pre>
 
<b>Base Syntax</b><br>
  var
<pre>
    float,number : float;
var
 
    float,number : float;
  {
 
begin
    number = 2.14;
    float = '''Ln'''(number);
  number := 2.14;
    ShowMessage('Ln('+FloatToStr(number)+') = '+FloatToStr(float));
  float := Ln(number);
 
  ShowMessage('Ln('+FloatToStr(number)+') = '+FloatToStr(float));
    float = Exp(float);
    ShowMessage('Exp(Ln('+FloatToStr(float)+')) = '+FloatToStr(float));
  float := Exp(float);
  }
  ShowMessage('Exp(Ln('+FloatToStr(float)+')) = '+FloatToStr(float));
 
end;
</pre>


<b>Output:</b><br>
<div class="alert alert-success" role="alert" data-bs-theme="light">
Ln(2,14) = 0,76080582903376<br>
Exp(Ln(2,14)) = 2,14
</div>


'''Output:'''<br>
<h2> See Also </h2>
Ln(2,14) = 0,76080582903376
* [[System_Library#Math_Functions | Math Functions]]
Exp(Ln(2,14)) = 2,14

Revision as of 10:52, 7 October 2024

The Ln function takes an integer or floating point Number and gives the natural logarithm of that number. This is only used for mathematical processing.

Ln has the opposite effect to Exp - the exponent of a number.

Example
TRObject Syntax

var
    float,number : float;
 
 {
 
   number = 2.14;
   float = Ln(number);
   ShowMessage('Ln('+FloatToStr(number)+') = '+FloatToStr(float));
 
   float = Exp(float);
   ShowMessage('Exp(Ln('+FloatToStr(float)+')) = '+FloatToStr(float));
 }

Base Syntax

 var
    float,number : float;
 
 begin
 
   number := 2.14;
   float := Ln(number);
   ShowMessage('Ln('+FloatToStr(number)+') = '+FloatToStr(float));
 
   float := Exp(float);
   ShowMessage('Exp(Ln('+FloatToStr(float)+')) = '+FloatToStr(float));
 end;

Output:

See Also