4 # Regression tests for the Math::Trig package
6 # The tests are quite modest as the Math::Complex tests exercise
7 # these quite vigorously.
9 # -- Jarkko Hietaniemi, April 1997
20 use vars qw($x $y $z);
25 abs($_[0] - $_[1]) < (defined $_[2] ? $_[2] : $eps);
31 print 'not ' unless (near(tan($x), sin($x) / cos($x)));
34 print 'not ' unless (near(sinh(2), 3.62686040784702));
37 print 'not ' unless (near(acsch(0.1), 2.99822295029797));
41 print 'not ' unless (ref $x eq 'Math::Complex');
44 # avoid using Math::Complex here
45 $x =~ /^([^-]+)(-[^i]+)i$/;
47 print 'not ' unless (near($y, 1.5707963267949) and
48 near($z, -1.31695789692482));
51 print 'not ' unless (near(deg2rad(90), pi/2));
54 print 'not ' unless (near(rad2deg(pi), 180));