changeset 16034:3e9ac47be013

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.
author Bruno Haible <bruno@clisp.org>
date Sat, 05 Nov 2011 17:00:34 +0100
parents 917610de47d7
children 88def2ddf509
files ChangeLog tests/test-ldexpl.c
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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'.
--- a/tests/test-ldexpl.c
+++ b/tests/test-ldexpl.c
@@ -94,7 +94,12 @@
   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)