From: Eric Blake Date: Wed, 30 Jul 2008 14:37:31 +0000 (-0600) Subject: test-strtod: allow compilation without -lm X-Git-Tag: v0.1~7178 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=d98e5eddd4e8bafff4e39da01c6a27ce25466da8;p=gnulib.git test-strtod: allow compilation without -lm * tests/test-strtod.c (main): Avoid link dependence on fabs. Reported by Dennis Clarke . Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index a84039aa1..69a1ebab0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-30 Eric Blake + + test-strtod: allow compilation without -lm + * tests/test-strtod.c (main): Avoid link dependence on fabs. + Reported by Dennis Clarke . + 2008-07-28 Jim Meyering bootstrap: work also when there are no .po files in po/ diff --git a/tests/test-strtod.c b/tests/test-strtod.c index 87d706298..704dc1e36 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); }