From: Bruno Haible <bruno@clisp.org>
Date: Sat, 5 Nov 2011 16:00:34 +0000 (+0100)
Subject: ldexpl tests: Avoid test failure on MSVC 9.
X-Git-Tag: v0.1~1492
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=d5a65f3e28c923d4b56deaeabb1e8ad594c51bae;p=gnulib.git

ldexpl tests: Avoid test failure on MSVC 9.

* tests/test-ldexpl.c (main): Use a temporary variable for the expected
value. Needed in order to enforce the conversion from a value greater
than LDBL_MAX to Infinity.
---

diff --git a/ChangeLog b/ChangeLog
index d07a4b1f45..bbb4c0b530 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-05  Bruno Haible  <bruno@clisp.org>
+
+	ldexpl tests: Avoid test failure on MSVC 9.
+	* tests/test-ldexpl.c (main): Use a temporary variable for the expected
+	value. Needed in order to enforce the conversion from a value greater
+	than LDBL_MAX to Infinity.
+
 2011-11-05  Bruno Haible  <bruno@clisp.org>
 
 	New modules 'at-internal', 'openat-h', split off from module 'openat'.
diff --git a/tests/test-ldexpl.c b/tests/test-ldexpl.c
index 5e921f61e8..e78e9a5d85 100644
--- a/tests/test-ldexpl.c
+++ b/tests/test-ldexpl.c
@@ -94,7 +94,12 @@ main ()
   for (i = 1, x = 1.73205L; i <= LDBL_MAX_EXP; i++, x *= 2.0L)
     {
       y = ldexpl (x, 0); ASSERT (y == x);
-      y = ldexpl (x, 5); ASSERT (y == x * 32.0L);
+      {
+        volatile long double expected;
+        y = ldexpl (x, 5);
+        expected = x * 32.0L;
+        ASSERT (y == expected);
+      }
       y = ldexpl (x, -5); ASSERT (y == x * 0.03125L);
     }
   for (i = 1, x = 1.73205L; i >= LDBL_MIN_EXP; i--, x *= 0.5L)