mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-23 18:51:35 +02:00
parent
e1ad1a02d2
commit
1da4c0c3ce
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -11442,6 +11442,7 @@ tests/test/units/math/tmask.pp svneol=native#text/plain
|
||||
tests/test/units/math/tmask2.pp svneol=native#text/plain
|
||||
tests/test/units/math/tnaninf.pp svneol=native#text/plain
|
||||
tests/test/units/math/tpower.pp svneol=native#text/pascal
|
||||
tests/test/units/math/tsincos.pp svneol=native#text/pascal
|
||||
tests/test/units/math/ttrig1.pp svneol=native#text/plain
|
||||
tests/test/units/matrix/tinv1.pp svneol=native#text/pascal
|
||||
tests/test/units/objects/testobj.pp svneol=native#text/plain
|
||||
|
@ -24,7 +24,7 @@ function arctan2(y,x : float) : float;assembler;
|
||||
|
||||
|
||||
{$define FPC_MATH_HAS_SINCOS}
|
||||
procedure sincos(theta : float;out sinus,cosinus : float);assembler;
|
||||
procedure sincos(theta : extended;out sinus,cosinus : extended);assembler;
|
||||
asm
|
||||
fldt theta
|
||||
fsincos
|
||||
@ -34,6 +34,26 @@ procedure sincos(theta : float;out sinus,cosinus : float);assembler;
|
||||
end;
|
||||
|
||||
|
||||
procedure sincos(theta : double;out sinus,cosinus : double);assembler;
|
||||
asm
|
||||
fldl theta
|
||||
fsincos
|
||||
fstpl (%edx)
|
||||
fstpl (%eax)
|
||||
fwait
|
||||
end;
|
||||
|
||||
|
||||
procedure sincos(theta : single;out sinus,cosinus : single);assembler;
|
||||
asm
|
||||
flds theta
|
||||
fsincos
|
||||
fstps (%edx)
|
||||
fstps (%eax)
|
||||
fwait
|
||||
end;
|
||||
|
||||
|
||||
{$define FPC_MATH_HAS_TAN}
|
||||
function tan(x : float) : float;assembler;
|
||||
asm
|
||||
|
@ -256,7 +256,16 @@ function radtocycle(rad : float) : float;inline;
|
||||
function tan(x : float) : float;
|
||||
function cotan(x : float) : float;
|
||||
function cot(x : float) : float; inline;
|
||||
procedure sincos(theta : float;out sinus,cosinus : float);
|
||||
{$ifdef FPC_HAS_TYPE_SINGLE}
|
||||
procedure sincos(theta : single;out sinus,cosinus : single);
|
||||
{$endif}
|
||||
{$ifdef FPC_HAS_TYPE_DOUBLE}
|
||||
procedure sincos(theta : double;out sinus,cosinus : double);
|
||||
{$endif}
|
||||
{$ifdef FPC_HAS_TYPE_EXTENDED}
|
||||
procedure sincos(theta : extended;out sinus,cosinus : extended);
|
||||
{$endif}
|
||||
|
||||
|
||||
function secant(x : float) : float; inline;
|
||||
function cosecant(x : float) : float; inline;
|
||||
@ -682,11 +691,31 @@ end;
|
||||
|
||||
|
||||
{$ifndef FPC_MATH_HAS_SINCOS}
|
||||
procedure sincos(theta : float;out sinus,cosinus : float);
|
||||
{$ifdef FPC_HAS_TYPE_SINGLE}
|
||||
procedure sincos(theta : single;out sinus,cosinus : single);
|
||||
begin
|
||||
sinus:=sin(theta);
|
||||
cosinus:=cos(theta);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
{$ifdef FPC_HAS_TYPE_DOUBLE}
|
||||
procedure sincos(theta : double;out sinus,cosinus : double);
|
||||
begin
|
||||
sinus:=sin(theta);
|
||||
cosinus:=cos(theta);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
{$ifdef FPC_HAS_TYPE_EXTENDED}
|
||||
procedure sincos(theta : extended;out sinus,cosinus : extended);
|
||||
begin
|
||||
sinus:=sin(theta);
|
||||
cosinus:=cos(theta);
|
||||
end;
|
||||
{$endif}
|
||||
{$endif FPC_MATH_HAS_SINCOS}
|
||||
|
||||
|
||||
|
17
tests/test/units/math/tsincos.pp
Normal file
17
tests/test/units/math/tsincos.pp
Normal file
@ -0,0 +1,17 @@
|
||||
uses
|
||||
math;
|
||||
var
|
||||
s1,s2 : single;
|
||||
d1,d2 : double;
|
||||
e1,e2 : extended;
|
||||
|
||||
begin
|
||||
sincos(0,s1,s2);
|
||||
sincos(0,d1,d2);
|
||||
sincos(0,e1,e2);
|
||||
if not(SameValue(s1,0)) or not(SameValue(s2,1)) or not(SameValue(d1,0)) or
|
||||
not(SameValue(d2,1)) or not(SameValue(e1,0)) or not(SameValue(e2,1)) then
|
||||
halt(1);
|
||||
writeln('ok');
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user