The test suite tweak in #6101 wasn't quite right.
[p5sagit/p5-mst-13.2.git] / t / lib / complex.t
index 1b4e189..b659142 100755 (executable)
@@ -27,7 +27,7 @@ my @script = (
 my $eps = 1e-13;
 
 if ($^O eq 'unicos') {         # For some reason root() produces very inaccurate
-    $eps = 1e-11;      # results in Cray UNICOS, and occasionally also
+    $eps = 1e-10;      # results in Cray UNICOS, and occasionally also
 }                      # cos(), sin(), cosh(), sinh().  The division
                        # of doubles is the current suspect.
 
@@ -159,20 +159,18 @@ test_dbz(
         'acsch(0)',
         'asec(0)',
         'asech(0)',
-        'atan(-$i)',
         'atan($i)',
 #       'atanh(-1)',   # Log of zero.
         'atanh(+1)',
         'cot(0)',
         'coth(0)',
         'csc(0)',
-        'tan($pip2)',
         'csch(0)',
-        'tan($pip2)',
        );
 
 test_loz(
         'log($zero)',
+        'atan(-$i)',
         'acot(-$i)',
         'atanh(-1)',
         'acoth(-1)',
@@ -187,7 +185,7 @@ sub test_broot {
        eval 'root(2, $op)';
        (\$bad) = (\$@ =~ /(.+)/);
        print "# $test op = $op badroot? \$bad...\n";
-       print 'not ' unless (\$@ =~ /root must be/);
+       print 'not ' unless (\$@ =~ /root rank must be/);
 EOT
         push(@script, qq(print "ok $test\\n";\n));
     }
@@ -263,9 +261,8 @@ EOS
 
     $test++;
     push @script, <<EOS;
-    my \$dj = "\$j"; \$dj =~ s/(\\d{14})\\d+i/\$1i/;
-    print "# j = \$dj (truncated for display)\n";
-    print "not " unless \$dj eq "-0.5+0.86602540378443i";
+    print "# j = \$j\n";
+    print "not " unless "\$j" =~ /^-0(?:\\.5(?:0000\\d+)?|\\.49999\\d+)\\+0.86602540\\d+i\$/;
     print "ok $test\n";
 
     \$j->display_format('style' => 'polar', 'polar_pretty_print' => 0);
@@ -273,9 +270,8 @@ EOS
 
     $test++;
     push @script, <<EOS;
-    my \$dj = "\$j"; \$dj =~ s/(\\d{12})\\d+\]/\$1]/;
-    print "# j = \$dj (truncated for display)\n";
-    print "not " unless \$dj eq "[1,2.094395102393]";
+    print "# j = \$j\n";
+    print "not " unless "\$j" =~ /^\\[1,2\\.09439510\\d+\\]\$/;
     print "ok $test\n";
 
     \$j->display_format('style' => 'cartesian', 'format' => '(%.5g)');
@@ -896,7 +892,7 @@ __END__
 ( 2,-3):(  1.96863792579310, -0.96465850440760)
 
 &acosh
-(-2.0,0):(  -1.31695789692482,  3.14159265358979)
+(-2.0,0):(   1.31695789692482,  3.14159265358979)
 (-1.0,0):(   0,                 3.14159265358979)
 (-0.5,0):(   0,                 2.09439510239320)
 ( 0.0,0):(   0,                 1.57079632679490)
@@ -906,8 +902,8 @@ __END__
 
 &acosh
 ( 2, 3):(  1.98338702991654,  1.00014354247380)
-(-2, 3):( -1.98338702991653, -2.14144911111600)
-(-2,-3):( -1.98338702991653,  2.14144911111600)
+(-2, 3):(  1.98338702991653,  2.14144911111600)
+(-2,-3):(  1.98338702991653, -2.14144911111600)
 ( 2,-3):(  1.98338702991654, -1.00014354247380)
 
 &atanh
@@ -926,15 +922,15 @@ __END__
 &asech
 (-2.0,0):(   0               , 2.09439510239320)
 (-1.0,0):(   0               , 3.14159265358979)
-(-0.5,0):(  -1.31695789692482, 3.14159265358979)
+(-0.5,0):(   1.31695789692482, 3.14159265358979)
 ( 0.5,0):(   1.31695789692482, 0               )
 ( 1.0,0):(   0               , 0               )
 ( 2.0,0):(   0               , 1.04719755119660)
 
 &asech
 ( 2, 3):(  0.23133469857397, -1.42041072246703)
-(-2, 3):( -0.23133469857397,  1.72118193112276)
-(-2,-3):( -0.23133469857397, -1.72118193112276)
+(-2, 3):(  0.23133469857397, -1.72118193112276)
+(-2,-3):(  0.23133469857397,  1.72118193112276)
 ( 2,-3):(  0.23133469857397,  1.42041072246703)
 
 &acsch