mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 23:39:31 +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
|
||||
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
|
||||
|
@ -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) }
|
||||
|
Loading…
Reference in New Issue
Block a user