Fix test to work on IRIX 6.5 with cc.
[pspp] / tests / test-math.c
index 56cf058c48e75f3ab7101b883dfcc4915f08381a..ec654b26010fcc497553b96fc71218d3356020eb 100644 (file)
@@ -30,9 +30,20 @@ choke me
 static float n = NAN;
 #endif
 
+/* Compare two numbers with ==.
+   This is a separate function because IRIX 6.5 "cc -O" miscompiles an
+   'x == x' test.  */
+static int
+numeric_equal (double x, double y)
+{
+  return x == y;
+}
+
 int
 main ()
 {
   double d = NAN;
-  return d == d;
+  if (numeric_equal (d, d))
+    return 1;
+  return 0;
 }