This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix the lib/complex failure of
authorAbigail <abigail@abigail.be>
Tue, 15 Aug 2000 04:06:38 +0000 (04:06 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 18 Aug 2000 04:12:30 +0000 (04:12 +0000)
       Subject: [ID 20000814.005] Not OK: perl v5.6.0 on i686-linux-64int 2.2.13
       Message-Id: <20000815040638.8524.qmail@foad.org>

Linux long double accuracy issue: something that
when printed with %g looks like "2" but int() of it is 1.

p4raw-id: //depot/perl@6689

lib/Math/Complex.pm

index e5434f4..af2b2a0 100644 (file)
@@ -1393,11 +1393,11 @@ sub stringify_polar {
 
        $t -= int(CORE::abs($t) / pit2) * pit2;
 
-       if ($format{polar_pretty_print}) {
+       if ($format{polar_pretty_print} && $t) {
            my ($a, $b);
            for $a (2..9) {
                $b = $t * $a / pi;
-               if (int($b) == $b) {
+               if ($b =~ /^-?\d+$/) {
                    $b = $b < 0 ? "-" : "" if CORE::abs($b) == 1;
                    $theta = "${b}pi/$a";
                    last;