12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- { %target=linux,freebsd,darwin,solaris,aix,android,haiku }
- {$mode objfpc}
- program testr;
- uses sysutils;
- function sprintf(buf,fmt : pchar) : longint; varargs;cdecl; external 'c';
- {$ifdef haiku}
- function cosh(f : double) : double; cdecl; external 'root';
- function ccos(f : double) : double; cdecl; external 'root' name 'cos';
- {$else}
- function cosh(f : double) : double; cdecl; external 'm';
- function ccos(f : double) : double; cdecl; external 'm' name 'cos';
- {$endif}
- 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));
- end;
- end;
- procedure DoTest;
- begin
- With TTest.Create(720) do
- Free;
- end;
- begin
- DoTest;
- end.
|