home *** CD-ROM | disk | FTP | other *** search
- PROGRAM x_to_n_time ;
-
- {
- This program demonstrates the time differences between use
- of the standard exponential functions and the x_to_n function.
-
- Source: "Raising X To The Nth Degree", TUG Lines Volume I Issue 5
- Author: Herb Holden
- Application: PC-DOS/MS-DOS
- }
-
- var n:integer ; y,t1,t2:real;
- {$i time.inc } {From TUG Lines Volume I Issue 3}
- {$i xton.inc }
-
- begin
- t1:=time ;
- for n:=1 to 100 do y:=xton(1.1,n) ; { 5.5 sec }
- t2:=time ;
- writeln('Time for xton: ',t2-t1:6:2) ;
-
- t1:=time ;
- for n:=1 to 100 do y:=exp(n*ln(1.1)) ; {16.5 sec }
- t2:=time ;
- writeln('Time for exp log: ',t2-t1:6:2) ;
- end.