Home

Math Functions: The Logarithm of Base N

     

Introduction

The LogN() function is used to calculate the logarithmic value of a number to the desired base. Its syntax is:

Extended __fastcall LogN(Extended Base, Extended Number);

This function takes two arguments. The second, Number, is the variable whose value will be evaluated. The first argument, Base, is used as the base of the logarithm. The formula used by this function is:

y = logbx

which is the same as

x = by
For the LogN() function, this formula would be:

LogN(Base, Number) = NumberBase;

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

	Base = StrToFloat(Edit1->Text);
	Number = StrToFloat(Edit2->Text);
	Result = LogN(Base, Number);

	Edit3->Text = FloatToStr(Result);
}
//---------------------------------------------------------------------------
   
     
 

Home Copyright © 2010-2011 FunctionX, Inc.