11 # compile time evaluation
14 is(substr($s,0,5), '1.414');
17 is(substr($s,0,7), '2.71828');
19 cmp_ok(exp(log(1)), '==', 1);
26 is(substr($s,0,5), '1.414');
29 is(substr($s,0,7), '2.71828');
31 cmp_ok(exp(log($x1)), '==', 1);
33 # tests for transcendental functions
35 my $pi = 3.1415926535897931160;
36 my $pi_2 = 1.5707963267948965580;
40 return sprintf("%.9f", $result);
44 cmp_ok(sin(0), '==', 0.0);
45 cmp_ok(round(sin($pi)), '==', 0.0);
46 cmp_ok(round(sin(-1 * $pi)), '==', 0.0);
47 cmp_ok(round(sin($pi_2)), '==', 1.0);
48 cmp_ok(round(sin(-1 * $pi_2)), '==', -1.0);
51 cmp_ok(cos(0), '==', 1.0);
52 cmp_ok(round(cos($pi)), '==', -1.0);
53 cmp_ok(round(cos(-1 * $pi)), '==', -1.0);
54 cmp_ok(round(cos($pi_2)), '==', 0.0);
55 cmp_ok(round(cos(-1 * $pi_2)), '==', 0.0);
57 # atan2() tests were removed due to differing results from calls to
58 # atan2() on various OS's and architectures. See perlport.pod for