mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 17:29:10 +02:00
+ i386 assembler implementations of tan, cotan, sincos
* default tan, cotan use now sincos git-svn-id: trunk@5809 -
This commit is contained in:
parent
abdcb8cdf2
commit
4b88079c41
@ -21,6 +21,38 @@ function arctan2(y,x : float) : float;assembler;
|
|||||||
fpatan
|
fpatan
|
||||||
fwait
|
fwait
|
||||||
end;
|
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;
|
function GetRoundMode: TFPURoundingMode;
|
||||||
begin
|
begin
|
||||||
|
@ -656,25 +656,35 @@ function radtocycle(rad : float) : float;
|
|||||||
radtocycle:=rad*(1/(2*pi));
|
radtocycle:=rad*(1/(2*pi));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifndef FPC_MATH_HAS_TAN}
|
||||||
function tan(x : float) : float;
|
function tan(x : float) : float;
|
||||||
|
var
|
||||||
|
_sin,_cos : float;
|
||||||
begin
|
begin
|
||||||
Tan:=Sin(x)/Cos(x)
|
sincos(x,_Sin,_Cos);
|
||||||
|
cotan:=_Sin/_Cos;
|
||||||
end;
|
end;
|
||||||
|
{$endif FPC_MATH_HAS_TAN}
|
||||||
|
|
||||||
|
|
||||||
|
{$ifndef FPC_MATH_HAS_COTAN}
|
||||||
function cotan(x : float) : float;
|
function cotan(x : float) : float;
|
||||||
|
var
|
||||||
|
_sin,_cos : float;
|
||||||
begin
|
begin
|
||||||
cotan:=Cos(X)/Sin(X);
|
sincos(x,_Sin,_Cos);
|
||||||
|
cotan:=_Cos/_Sin;
|
||||||
end;
|
end;
|
||||||
|
{$endif FPC_MATH_HAS_COTAN}
|
||||||
|
|
||||||
|
|
||||||
|
{$ifndef FPC_MATH_HAS_SINCOS}
|
||||||
procedure sincos(theta : float;out sinus,cosinus : float);
|
procedure sincos(theta : float;out sinus,cosinus : float);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
sinus:=sin(theta);
|
sinus:=sin(theta);
|
||||||
cosinus:=cos(theta);
|
cosinus:=cos(theta);
|
||||||
end;
|
end;
|
||||||
|
{$endif FPC_MATH_HAS_SINCOS}
|
||||||
|
|
||||||
|
|
||||||
{ ArcSin and ArcCos from Arjan van Dijk (arjan.vanDijk@User.METAIR.WAU.NL) }
|
{ ArcSin and ArcCos from Arjan van Dijk (arjan.vanDijk@User.METAIR.WAU.NL) }
|
||||||
|
Loading…
Reference in New Issue
Block a user