+ i386 assembler implementations of tan, cotan, sincos

* default tan, cotan use now sincos

git-svn-id: trunk@5809 -
This commit is contained in:
florian 2007-01-04 12:58:40 +00:00
parent abdcb8cdf2
commit 4b88079c41
2 changed files with 48 additions and 6 deletions

View File

@ -21,6 +21,38 @@ function arctan2(y,x : float) : float;assembler;
fpatan
fwait
end;
{$define FPC_MATH_HAS_SINCOS}
procedure sincos(theta : float;out sinus,cosinus : float);assembler;
asm
fldt theta
fsincos
fstpt (%edx)
fstpt (%eax)
fwait
end;
{$define FPC_MATH_HAS_TAN}
function tan(x : float) : float;assembler;
asm
fldt X
fptan
fstp %st
fwait
end;
{$define FPC_MATH_HAS_COTAN}
function cotan(x : float) : float;assembler;
asm
fldt X
fptan
fdivrp
fwait
end;
function GetRoundMode: TFPURoundingMode;
begin

View File

@ -656,25 +656,35 @@ function radtocycle(rad : float) : float;
radtocycle:=rad*(1/(2*pi));
end;
{$ifndef FPC_MATH_HAS_TAN}
function tan(x : float) : float;
var
_sin,_cos : float;
begin
Tan:=Sin(x)/Cos(x)
sincos(x,_Sin,_Cos);
cotan:=_Sin/_Cos;
end;
{$endif FPC_MATH_HAS_TAN}
{$ifndef FPC_MATH_HAS_COTAN}
function cotan(x : float) : float;
var
_sin,_cos : float;
begin
cotan:=Cos(X)/Sin(X);
sincos(x,_Sin,_Cos);
cotan:=_Cos/_Sin;
end;
{$endif FPC_MATH_HAS_COTAN}
{$ifndef FPC_MATH_HAS_SINCOS}
procedure sincos(theta : float;out sinus,cosinus : float);
begin
sinus:=sin(theta);
cosinus:=cos(theta);
end;
{$endif FPC_MATH_HAS_SINCOS}
{ ArcSin and ArcCos from Arjan van Dijk (arjan.vanDijk@User.METAIR.WAU.NL) }