home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / MADTRB11.ZIP / XTON.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-08-05  |  624 b   |  26 lines

  1. PROGRAM x_to_n_time ;
  2.  
  3. {
  4. This program demonstrates the time differences between use
  5. of the standard exponential functions and the x_to_n function.
  6.  
  7. Source: "Raising X To The Nth Degree", TUG Lines Volume I Issue 5
  8. Author: Herb Holden
  9. Application: PC-DOS/MS-DOS
  10. }
  11.  
  12. var n:integer ; y,t1,t2:real;
  13. {$i time.inc }   {From TUG Lines Volume I Issue 3}
  14. {$i xton.inc }
  15.  
  16. begin
  17. t1:=time ;
  18. for n:=1 to 100 do y:=xton(1.1,n) ;   { 5.5 sec }
  19. t2:=time ;
  20. writeln('Time for xton: ',t2-t1:6:2) ;
  21.  
  22. t1:=time ;
  23. for n:=1 to 100 do y:=exp(n*ln(1.1)) ; {16.5 sec }
  24. t2:=time ;
  25. writeln('Time for exp log: ',t2-t1:6:2) ;
  26. end.