about summary refs log tree commit diff
path: root/math/test-misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/test-misc.c')
-rw-r--r--math/test-misc.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/math/test-misc.c b/math/test-misc.c
index fa958d486c..d2393cc840 100644
--- a/math/test-misc.c
+++ b/math/test-misc.c
@@ -1,5 +1,5 @@
 /* Miscellaneous tests which don't fit anywhere else.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -1143,5 +1143,45 @@ main (void)
   }
 #endif
 
+  /* The tests here are very similar to tests earlier in this file,
+     the important difference is just that there are no intervening
+     union variables that cause some GCC versions to hide possible
+     bugs in nextafter* implementation.  */
+  if (nextafterf (nextafterf (FLT_MIN, FLT_MIN / 2.0), FLT_MIN) != FLT_MIN)
+    {
+      puts ("nextafterf FLT_MIN test failed");
+      result = 1;
+    }
+  if (nextafterf (nextafterf (-FLT_MIN, -FLT_MIN / 2.0), -FLT_MIN)
+      != -FLT_MIN)
+    {
+      puts ("nextafterf -FLT_MIN test failed");
+      result = 1;
+    }
+  if (nextafter (nextafter (DBL_MIN, DBL_MIN / 2.0), DBL_MIN) != DBL_MIN)
+    {
+      puts ("nextafter DBL_MIN test failed");
+      result = 1;
+    }
+  if (nextafter (nextafter (-DBL_MIN, -DBL_MIN / 2.0), -DBL_MIN) != -DBL_MIN)
+    {
+      puts ("nextafter -DBL_MIN test failed");
+      result = 1;
+    }
+#ifndef NO_LONG_DOUBLE
+  if (nextafterl (nextafterl (LDBL_MIN, LDBL_MIN / 2.0), LDBL_MIN)
+      != LDBL_MIN)
+    {
+      puts ("nextafterl LDBL_MIN test failed");
+      result = 1;
+    }
+  if (nextafterl (nextafterl (-LDBL_MIN, -LDBL_MIN / 2.0), -LDBL_MIN)
+      != -LDBL_MIN)
+    {
+      puts ("nextafterl -LDBL_MIN test failed");
+      result = 1;
+    }
+#endif
+
   return result;
 }