This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline. Builds lots of sv.h/embed.h redef warnings
[perl5.git] / t / op / exp.t
1 #!./perl
2
3 # $RCSfile: exp.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:50 $
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";}