[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FAIL: test-strtod
From: |
Eric Blake |
Subject: |
Re: FAIL: test-strtod |
Date: |
Wed, 30 Jul 2008 07:42:52 -0700 (PDT) |
> Somehow, the test needs to be made more robust; we either need more m4
> magic to determine if -lm is necessary for fabs, or a gnulib replacement
> for fabs that works without requiring libm, or a way to rewrite that test
> to not need fabs. In the meantime, feel free to manually add -lm to the
> link line for that particular test program.
Done as follows (I went with the latter option of avoiding fabs
altogether; the replacement FABS fails for -0.0, but that is
inconsequential for this test):
From: Eric Blake <address@hidden>
Date: Wed, 30 Jul 2008 08:37:31 -0600
Subject: [PATCH] test-strtod: allow compilation without -lm
* tests/test-strtod.c (main): Avoid link dependence on fabs.
Reported by Dennis Clarke <address@hidden>.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
tests/test-strtod.c | 7 +++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a84039a..69a1eba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-07-30 Eric Blake <address@hidden>
+
+ test-strtod: allow compilation without -lm
+ * tests/test-strtod.c (main): Avoid link dependence on fabs.
+ Reported by Dennis Clarke <address@hidden>.
+
2008-07-28 Jim Meyering <address@hidden>
bootstrap: work also when there are no .po files in po/
diff --git a/tests/test-strtod.c b/tests/test-strtod.c
index 87d7062..704dc1e 100644
--- a/tests/test-strtod.c
+++ b/tests/test-strtod.c
@@ -39,6 +39,9 @@
} \
while (0)
+/* Avoid requiring -lm just for fabs. */
+#define FABS(d) ((d) < 0.0 ? -(d) : (d))
+
int
main ()
{
@@ -163,7 +166,7 @@ main ()
/* 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 (FABS (result - 0.5) < DBL_EPSILON);
ASSERT (ptr == input + 2);
ASSERT (errno == 0);
}
@@ -246,7 +249,7 @@ main ()
/* 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 (FABS (result - 0.5) < DBL_EPSILON);
ASSERT (ptr == input + 4);
ASSERT (errno == 0);
}
--
1.5.6.4
--
View this message in context:
http://www.nabble.com/Re%3A-FAIL%3A-test-strtod-tp18725921p18734859.html
Sent from the Gnulib mailing list archive at Nabble.com.