mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 17:00:40 +02:00
* test fpu with c
This commit is contained in:
parent
b6ed8c482b
commit
b52a962e00
46
tests/test/testfpuc.pp
Normal file
46
tests/test/testfpuc.pp
Normal file
@ -0,0 +1,46 @@
|
||||
{ %target=linux,freebsd }
|
||||
|
||||
{$mode objfpc}
|
||||
program testr;
|
||||
|
||||
uses sysutils;
|
||||
function sprintf(buf,fmt : pchar) : longint; varargs;cdecl; external 'c';
|
||||
function cosh(f : double) : double; cdecl; external 'm';
|
||||
function ccos(f : double) : double; cdecl; external 'm' name 'cos';
|
||||
|
||||
Type
|
||||
TTest = Class(TObject)
|
||||
Constructor Create(Max : Integer);
|
||||
end;
|
||||
|
||||
Constructor TTest.Create(Max : Integer);
|
||||
|
||||
Var
|
||||
I,J : integer;
|
||||
F : single;
|
||||
buf : ansistring;
|
||||
|
||||
begin
|
||||
For I:=1 to Max do
|
||||
begin
|
||||
F:=ccos(I/180*pi);
|
||||
setlength(buf,100);
|
||||
setlength(buf,sprintf(pchar(buf),'%d: f: %f and round f*10: ',i,f));
|
||||
f:=f*10.0;
|
||||
f:=cosh(f);
|
||||
writeln(buf,round(F));
|
||||
f:=cosh(f);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DoTest;
|
||||
|
||||
begin
|
||||
With TTest.Create(720) do
|
||||
Free;
|
||||
end;
|
||||
|
||||
begin
|
||||
DoTest;
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user