Avoid negating 0.0L - it yields a wrong result on HP-UX/hppa.
authorBruno Haible <bruno@clisp.org>
Sun, 13 Apr 2008 19:20:17 +0000 (21:20 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 13 Apr 2008 19:20:17 +0000 (21:20 +0200)
ChangeLog
tests/test-signbit.c

index 58303a3..b9b9692 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-04-13  Bruno Haible  <bruno@clisp.org>
 
+       Make test-signbit pass on HP-UX/hppa.
+       * tests/test-signbit.c (minus_zerol): New variable.
+       (test_signbitl): Use it.
+
+2008-04-13  Bruno Haible  <bruno@clisp.org>
+
        Make truncl work on OSF/1 4.0.
        * m4/truncl.m4 (gl_FUNC_TRUNCL): Test whether truncl actually works.
        Set REPLACE_TRUNCL, not HAVE_DECL_TRUNCL.
index 1d1a2a8..2245e02 100644 (file)
@@ -39,6 +39,9 @@
 float zerof = 0.0f;
 double zerod = 0.0;
 long double zerol = 0.0L;
+/* We cannot use the expression '-zerol' here, because on HP-UX/hppa it
+   evaluates to 0.0L, not -0.0L.  */
+long double minus_zerol = -0.0L;
 
 static void
 test_signbitf ()
@@ -140,7 +143,7 @@ test_signbitl ()
   ASSERT (signbit (-2.718e-30L));
   /* Zeros.  */
   ASSERT (!signbit (0.0L));
-  if (1.0L / -zerol < 0)
+  if (1.0L / minus_zerol < 0)
     ASSERT (signbit (-0.0L));
   else
     ASSERT (!signbit (-0.0L));