changeset 40171:fbfa1d6417d9

strtod, strtold tests: Simplify tests. * tests/test-strtod.c (main): Assume no rounding errors for 0.5. * tests/test-strtold.c (main): Likewise.
author Bruno Haible <bruno@clisp.org>
date Fri, 01 Feb 2019 02:51:20 +0100
parents 201ca4418b4b
children 31ab89a208b9
files ChangeLog tests/test-strtod.c tests/test-strtold.c
diffstat 3 files changed, 10 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Feb 01 01:43:41 2019 +0100
+++ b/ChangeLog	Fri Feb 01 02:51:20 2019 +0100
@@ -1,3 +1,9 @@
+2019-01-31  Bruno Haible  <bruno@clisp.org>
+
+	strtod, strtold tests: Simplify tests.
+	* tests/test-strtod.c (main): Assume no rounding errors for 0.5.
+	* tests/test-strtold.c (main): Likewise.
+
 2019-01-31  Bruno Haible  <bruno@clisp.org>
 
 	strtod, strtold: Avoid unnecessary rounding errors.
--- a/tests/test-strtod.c	Fri Feb 01 01:43:41 2019 +0100
+++ b/tests/test-strtod.c	Fri Feb 01 02:51:20 2019 +0100
@@ -155,10 +155,7 @@
     double result;
     errno = 0;
     result = strtod (input, &ptr);
-    /* FIXME - gnulib's version is rather inaccurate.  It would be
-       nice to guarantee an exact result, but for now, we settle for a
-       1-ulp error.  */
-    ASSERT (FABS (result - 0.5) < DBL_EPSILON);
+    ASSERT (result == 0.5);
     ASSERT (ptr == input + 2);
     ASSERT (errno == 0);
   }
@@ -238,10 +235,7 @@
     double result;
     errno = 0;
     result = strtod (input, &ptr);
-    /* FIXME - gnulib's version is rather inaccurate.  It would be
-       nice to guarantee an exact result, but for now, we settle for a
-       1-ulp error.  */
-    ASSERT (FABS (result - 0.5) < DBL_EPSILON);
+    ASSERT (result == 0.5);
     ASSERT (ptr == input + 4);
     ASSERT (errno == 0);
   }
--- a/tests/test-strtold.c	Fri Feb 01 01:43:41 2019 +0100
+++ b/tests/test-strtold.c	Fri Feb 01 02:51:20 2019 +0100
@@ -155,10 +155,7 @@
     long double result;
     errno = 0;
     result = strtold (input, &ptr);
-    /* FIXME - gnulib's version is rather inaccurate.  It would be
-       nice to guarantee an exact result, but for now, we settle for a
-       1-ulp error.  */
-    ASSERT (FABSL (result - 0.5L) < LDBL_EPSILON);
+    ASSERT (result == 0.5L);
     ASSERT (ptr == input + 2);
     ASSERT (errno == 0);
   }
@@ -238,10 +235,7 @@
     long double result;
     errno = 0;
     result = strtold (input, &ptr);
-    /* FIXME - gnulib's version is rather inaccurate.  It would be
-       nice to guarantee an exact result, but for now, we settle for a
-       1-ulp error.  */
-    ASSERT (FABSL (result - 0.5L) < LDBL_EPSILON);
+    ASSERT (result == 0.5L);
     ASSERT (ptr == input + 4);
     ASSERT (errno == 0);
   }