ESBLog10 Function
Returns Logarithm of X to Base 10.

Unit
QESBPCSMath

Declaration
Function ESBLog10(const X: Extended): Extended;

Parameters
Value to process.

Category
Arithmetic Routines for Floats

Implementation

function ESBLog10 (const X: Extended): Extended;

function FLog10 (X: Extended): Extended;
     asm
		fldlg2			// St(0) <- Log10 of 2
		fld		[X]		// St(0) <- X, St(1) <- Log10 of 2
		fyl2x			// St(0) <- log10 (2) * Log2 (X)
		fwait

     end;

     function AltFLog10 (X: Extended): Extended;
     asm
		fldlg2			// St(0) <- Log10 of 2
		fld		[X]		// St(0) <- X, St(1) <- Log10 of 2
		fyl2xp1			// St(0) <- log10 (2) * Log2 (X+1)
		fwait

     end;
begin
     if not FloatIsPositive (X) then // must be Positive
          raise EMathError.Create (rsValueGZero)
     else if abs (X - 1) < 0.1 then
          Result := AltFLog10 (X - 1)
     else
          Result := FLog10 (X);
End;


HTML generated by Time2HELP
http://www.time2help.com