home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / math / roottest.pas < prev   
Pascal/Delphi Source File  |  1995-07-28  |  982b  |  31 lines

  1. {$n-}                           {coprocessor off}
  2. Function Rootfct(Radicand:LongInt):Integer;external;
  3. {$l Root}
  4. {Enter the path of the Assembler module Root.obj here !}
  5.  
  6. var i:word;                     {loop counter}
  7.     n:Integer;                  {result of integer calculation}
  8.     r:Real;                     {result of real calculation}
  9.  
  10. Procedure Root_new;             {calculates root by integer approximation}
  11. Begin
  12.   For i:=1 to 10000 do          {run 10000 times,}
  13.     n:=Rootfct(87654321);       {to obtain speed comparison}
  14. End;
  15.  
  16. Procedure Root_real;            {calculates root via Pascal function}
  17. Begin
  18.   For i:=1 to 10000 do          {run 10000 times,}
  19.     r:=Sqrt(87654321);          {to get speed comparison}
  20. End;
  21.  
  22. Begin
  23.   writeLn;
  24.   WriteLn('Root calculation via Pascal function begins');
  25.   Root_Real;
  26.   WriteLn('result: ',r:0:0);
  27.   WriteLn('Root calculation via integer function begins');
  28.   Root_new;
  29.   WriteLn('result: ',n);
  30. End.
  31.