11 # compile time evaluation
14 is(substr($s,0,5), '1.414');
17 is(substr($s,0,7), '2.71828');
26 is(substr($s,0,5), '1.414');
29 is(substr($s,0,7), '2.71828');
31 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);
45 ok(round(sin($pi)) == 0.0);
46 ok(round(sin(-1 * $pi)) == 0.0);
47 ok(round(sin($pi_2)) == 1.0);
48 ok(round(sin(-1 * $pi_2)) == -1.0);
52 ok(round(cos($pi)) == -1.0);
53 ok(round(cos(-1 * $pi)) == -1.0);
54 ok(round(cos($pi_2)) == 0.0);
55 ok(round(cos(-1 * $pi_2)) == 0.0);
58 ok(round(atan2(-0.0, 0.0)) == 0);
59 ok(round(atan2(0.0, 0.0)) == 0);
60 ok(round(atan2(-0.0, -0.0)) == round(-1 * $pi));
61 ok(round(atan2(0.0, -0.0)) == round($pi));
62 ok(round(atan2(-1.0, 0.0)) == round(-1 * $pi_2));
63 ok(round(atan2(1.0, 0.0)) == round($pi_2));