From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<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> | ||
<b>Example</b><br> | |||
<b>TRObject Syntax</b><br> | |||
<pre> | |||
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)); | |||
} | |||
</pre> | |||
<b>Base Syntax</b><br> | |||
<pre> | |||
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; | |||
</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> | |||
<h2> See Also </h2> | |||
* [[System_Library#Math_Functions | Math Functions]] | |||
Revision as of 10:52, 7 October 2024
function Ln(const X: Extended): Extended;
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:
Ln(2,14) = 0,76080582903376
Exp(Ln(2,14)) = 2,14