esercizi di funzioni numerichecon turbo pascal 1.1 su mac
Program matema; { esempio uso funzioni matematiche con FIXMATH }
uses memtypes,quickdraw,OSINTF,ToolIntf,fixmath;
procedure calcolo; var y,x:integer; begin writeln('testo'); writeln(fixdiv(100,3)); writeln(fixdiv(1000,3)); writeln(fixdiv(10000,3)); writeln(abs(-20)); writeln(fracsqrt(1000)); writeln(fraccos(fixratio(y,4)),1073741824); writeln(fraccos(fixratio(y,8)),1073741824); writeln(fracsin(fixratio(x,4)),1073741824); writeln(fracsin(fixratio(x,8)),1073741824); writeln(random); writeln(random); writeln(fixmul(100,100)); writeln(fraccos(fixratio(y,4)),873741824); writeln(fraccos(fixratio(y,4)),1073741824); writeln(fracsin(fixratio(x,4)),573741824); writeln(fracsin(fixratio(x,4)),1073741824); writeln(random); writeln(random); writeln(fixmul(100,100)); readln; end;
begin calcolo; end.
program numeri; { relazione tra numeri interi e fixed:cfr.griglia.pas con 3D }
uses memtypes,fixmath;
var a,b,c,d,e,f,g,h:fixed; begin a:=65536; b:=a*3; c:=a*10; d:=a*(-10); e:=a*15; f:=a*(-15); g:=a*30; h:=a*70; writeln('a=',a); writeln('a*3...scale.............................196608=',b); writeln('a*10...lookat..........................655360=',c); writeln('a*(-10)...lookat.....................-655360=',d); writeln('a*15...lookat...........................983040=',e); writeln('a*(-15)...lookat......................-983040=',f); writeln('a*30...roll...viewangle............1966080=',g); writeln('a*70...pitch.............................4587520=',h); readln; end.
program numeri1; { relazione tra numeri interi e fixed: }
uses memtypes,quickdraw,osintf,toolintf,fixmath,graf3D;
{ costante per operazioni con angoli e radianti:17157 }
var a,b,c,d,e,f,g,h,p,q,r:fixed;
begin
A:=1073741824; B:=65536; c:=fixratio(A,B); writeln(c);
e:=262144; d:=fixdiv(a,e); writeln(d);
g:=262155; f:=fixmul(e,g); writeln(f);
p:=16384; q:=fracsqrt(p); writeln(q);
r:=fracsin(p); writeln(r);
r:=fraccos(p); writeln(r); readln; end.