ESBArcTan Function
Returns the ArcTangent of Y / X - Result is in Radians.

Unit
QESBPCSMath

Declaration
Function ESBArcTan(const X, Y: Extended): Extended;

Description
Results are given between -Pi and Pi.

Parameters
First Float to process
Second Float to process

Category
Arithmetic Routines for Floats

Implementation

function ESBArcTan (const X, Y: Extended): Extended;

function FArcTan (X, Y: Extended): Extended;
     asm
		fld		[Y]		// St(0) <- Y
		fld	     [X]		// St(0) <- X, St (1) <- Y
		fpatan			// St(0) <- ArcTan (Y/X)
		fwait

     end;
begin
     if FloatIsZero (X) then
     begin
          if FloatIsZero (Y) then
               Result := 0
          else if Y > 0 then
               Result := PiOn2
          else
               Result := -PiOn2
     end
     else if FloatIsZero (Y) then
     begin
          if X > 0 then
               Result := 0
          else
               Result := ESBPi
     end
     else
          Result := FArcTan (X, Y);
End;


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