summaryrefslogtreecommitdiff
path: root/t/lib/trig.t
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1997-04-03 10:03:25 +1200
committerChip Salzenberg <chip@atlantic.net>1997-04-03 10:03:25 +1200
commit5aabfad66ac77650f584e2f07af91645e19fe296 (patch)
treeac96571984ba780e9ae7736cfe85dd17f6cfd865 /t/lib/trig.t
parent4a6725af9146bd7faaa10aa5429ff009d393fd6d (diff)
downloadperl-5aabfad66ac77650f584e2f07af91645e19fe296.tar.gz
[inseparable changes from match from perl-5.003_97 to perl-5.003_97a]
CORE PORTABILITY Subject: Add support for Cygwin32 (GNU-Win32) -- very low impact Date: Thu, 3 Apr 1997 09:21:17 +0100 From: John Cerney <j-cerney1@ti.com> Files: MANIFEST README.cygwin32 cygwin32/cw32imp.h cygwin32/gcc2 cygwin32/ld2 cygwin32/perlgcc cygwin32/perlld ext/DynaLoader/dl_cygwin32.xs hints/cygwin32.sh perl.h pp_sys.c Msg-ID: 199704030821.JAA08762@pluto.tiuk.ti.com (applied based on p5p patch as commit 2a079e0090406b1b2e50643540f149206c9e9de8) Subject: Win32 update (six patches) From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: MANIFEST README.win32 dosish.h t/io/fs.t t/io/tell.t t/lib/io_tell.t t/op/magic.t t/op/mkdir.t t/op/runlevel.t t/op/stat.t t/op/taint.t win32/Makefile win32/VC-2.0/pod.mak win32/makedef.pl win32/pod.mak win32/win32.c win32/win32.h win32/win32io.c win32/win32io.h win32/win32iop.h LIBRARY AND EXTENSIONS Subject: Math::Trig, based on (and from an author of) Math::Complex From: Chip Salzenberg <chip@perl.com> Files: MANIFEST lib/Math/Complex.pm lib/Math/Trig.pm pod/perldelta.pod t/lib/complex.t t/lib/trig.t OTHER CORE CHANGES Subject: Fix const-sub-related panic on C<sub foo { my $x; 0 } foo> From: Chip Salzenberg <chip@perl.com> Files: op.c Subject: Fix warning for useless C<1..2> From: Chip Salzenberg <chip@perl.com> Files: op.c Subject: Minor cleanups Date: Thu, 03 Apr 1997 19:56:57 -0500 From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: mg.c mg.h perl.c Msg-ID: 199704040056.TAA22253@aatma.engin.umich.edu (applied based on p5p patch as commit 609794497049cf42bdd2396c04cbb7728e10374d) Subject: Eliminate unreliable warning with %SIG and strict refs From: Chip Salzenberg <chip@perl.com> Files: mg.c Subject: Fix impossible test in vivification From: Chip Salzenberg <chip@perl.com> Files: mg.c
Diffstat (limited to 't/lib/trig.t')
-rw-r--r--t/lib/trig.t54
1 files changed, 54 insertions, 0 deletions
diff --git a/t/lib/trig.t b/t/lib/trig.t
new file mode 100644
index 0000000000..57746fdcd4
--- /dev/null
+++ b/t/lib/trig.t
@@ -0,0 +1,54 @@
+#!./perl
+
+#
+# Regression tests for the Math::Trig package
+#
+# The tests are quite modest as the Math::Complex tests exercise
+# these quite vigorously.
+#
+# -- Jarkko Hietaniemi, April 1997
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+use Math::Trig;
+
+use strict;
+
+use vars qw($x $y $z);
+
+my $eps = 1e-11;
+
+sub near ($$;$) {
+ abs($_[0] - $_[1]) < (defined $_[2] ? $_[2] : $eps);
+}
+
+print "1..6\n";
+
+$x = 0.9;
+print 'not ' unless (near(tan($x), sin($x) / cos($x)));
+print "ok 1\n";
+
+print 'not ' unless (near(sinh(2), 3.62686040784702));
+print "ok 2\n";
+
+print 'not ' unless (near(acsch(0.1), 2.99822295029797));
+print "ok 3\n";
+
+$x = asin(2);
+print 'not ' unless (ref $x eq 'Math::Complex');
+print "ok 4\n";
+
+# avoid using Math::Complex here
+$x =~ /^([^-]+)(-[^i]+)i$/;
+($y, $z) = ($1, $2);
+print 'not ' unless (near($y, 1.5707963267949) and
+ near($z, -1.31695789692482));
+print "ok 5\n";
+
+print 'not ' unless (near(deg_to_rad(90), pi/2));
+print "ok 6\n";
+
+# eof