xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/op/exp.t (revision 0:68f95e015346)
1#!./perl
2
3# $RCSfile: exp.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:50 $
4
5print "1..6\n";
6
7# compile time evaluation
8
9$s = sqrt(2);
10if (substr($s,0,5) eq '1.414') {print "ok 1\n";} else {print "not ok 1\n";}
11
12$s = exp(1);
13if (substr($s,0,7) eq '2.71828') {print "ok 2\n";} else {print "not ok 2\n";}
14
15if (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);
22if (substr($s,0,5) eq '1.414') {print "ok 4\n";} else {print "not ok 4\n";}
23
24$s = exp($x1);
25if (substr($s,0,7) eq '2.71828') {print "ok 5\n";} else {print "not ok 5\n";}
26
27if (exp(log($x1)) == 1) {print "ok 6\n";} else {print "not ok 6\n";}
28