home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / perl / os2perl / exp.t < prev    next >
Text File  |  1991-04-12  |  686b  |  28 lines

  1. #!./perl
  2.  
  3. # $Header: exp.t,v 4.0 91/03/20 01:52:31 lwall Locked $
  4.  
  5. print "1..6\n";
  6.  
  7. # compile time evaluation
  8.  
  9. $s = sqrt(2);
  10. if (substr($s,0,5) eq '1.414') {print "ok 1\n";} else {print "not ok 1\n";}
  11.  
  12. $s = exp(1);
  13. if (substr($s,0,7) eq '2.71828') {print "ok 2\n";} else {print "not ok 2\n";}
  14.  
  15. if (exp(log(1)) == 1) {print "ok 3\n";} else {print "not ok 3\n";}
  16.  
  17. # run time evaluation
  18.  
  19. $x1 = 1;
  20. $x2 = 2;
  21. $s = sqrt($x2);
  22. if (substr($s,0,5) eq '1.414') {print "ok 4\n";} else {print "not ok 4\n";}
  23.  
  24. $s = exp($x1);
  25. if (substr($s,0,7) eq '2.71828') {print "ok 5\n";} else {print "not ok 5\n";}
  26.  
  27. if (exp(log($x1)) == 1) {print "ok 6\n";} else {print "not ok 6\n";}
  28.