This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
vax-netbsd: Negative zero is only a thing IEEE 754.
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 21 Oct 2016 12:27:47 +0000 (08:27 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 22 Oct 2016 00:13:39 +0000 (20:13 -0400)
So don't assume it universal in the signbit emulation.

For non-IEEE-754, negative zero is equal to the positive zero.

(Another matter is that signbit() should have been found
in the Configure scan; it does exist in the netbsd/vax.)

ext/POSIX/POSIX.xs

index b573f5e..f8288e3 100644 (file)
@@ -2636,7 +2636,12 @@ fpclassify(x)
 #ifdef Perl_signbit
            RETVAL = Perl_signbit(x);
 #else
 #ifdef Perl_signbit
            RETVAL = Perl_signbit(x);
 #else
-           RETVAL = (x < 0) || (x == -0.0);
+           RETVAL = (x < 0);
+#ifdef DOUBLE_IS_IEEE_FORMAT
+            if (x == -0.0) {
+              RETVAL = TRUE;
+            }
+#endif
 #endif
            break;
        }
 #endif
            break;
        }