Home

Math Functions: The Natural Logarithm of a Number

     

Introduction

The LnXP1() function is used to calculate the natural logarithm of a number that is being incremented to 1. The syntax of this function is

Extended __fastcall LnXP1(Extended X);

When executing, this function takes one argument, X, adds 1 to X, and then calculates the natural logarithm, also called the Napierian logarithm, of the new number. The formula used is

Result = ln(X+1)

Here is an example:

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	Extended X, Result;

	X = StrToFloat(Edit1->Text);
	Result = LnXP1(X);
	Edit2->Text = FloatToStr(Result);
}
//---------------------------------------------------------------------------
 

 

   
     
 

Home Copyright © 2010-2011 FunctionX, Inc.