projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add u64-tests module.
[gnulib.git]
/
tests
/
test-strtod.c
diff --git
a/tests/test-strtod.c
b/tests/test-strtod.c
index
12d3606
..
d99e5fe
100644
(file)
--- a/
tests/test-strtod.c
+++ b/
tests/test-strtod.c
@@
-25,7
+25,7
@@
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
-#include "isnand.h"
+#include "isnand
-nolibm
.h"
#define ASSERT(expr) \
do \
#define ASSERT(expr) \
do \
@@
-39,6
+39,13
@@
} \
while (0)
} \
while (0)
+/* Avoid requiring -lm just for fabs. */
+#define FABS(d) ((d) < 0.0 ? -(d) : (d))
+
+/* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0.
+ So we use -zero instead. */
+double zero = 0.0;
+
int
main ()
{
int
main ()
{
@@
-163,7
+170,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. */
/* 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);
}
ASSERT (ptr == input + 2);
ASSERT (errno == 0);
}
@@
-246,7
+253,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. */
/* 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);
}
ASSERT (ptr == input + 4);
ASSERT (errno == 0);
}
@@
-314,7
+321,7
@@
main ()
errno = 0;
result = strtod (input, &ptr);
ASSERT (result == 0.0);
errno = 0;
result = strtod (input, &ptr);
ASSERT (result == 0.0);
- ASSERT (!!signbit (result) == !!signbit (-
0.0
)); /* IRIX 6.5, OSF/1 4.0 */
+ ASSERT (!!signbit (result) == !!signbit (-
zero
)); /* IRIX 6.5, OSF/1 4.0 */
ASSERT (ptr == input + 2);
ASSERT (errno == 0);
}
ASSERT (ptr == input + 2);
ASSERT (errno == 0);
}
@@
-409,7
+416,7
@@
main ()
errno = 0;
result = strtod (input, &ptr);
ASSERT (result == 0.0);
errno = 0;
result = strtod (input, &ptr);
ASSERT (result == 0.0);
- ASSERT (!!signbit (result) == !!signbit (-
0.0
)); /* MacOS X 10.3, FreeBSD 6.2, IRIX 6.5, OSF/1 4.0 */
+ ASSERT (!!signbit (result) == !!signbit (-
zero
)); /* MacOS X 10.3, FreeBSD 6.2, IRIX 6.5, OSF/1 4.0 */
ASSERT (ptr == input + 2); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */
ASSERT (errno == 0);
}
ASSERT (ptr == input + 2); /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2 */
ASSERT (errno == 0);
}
@@
-534,7
+541,7
@@
main ()
0 on negative underflow, even though quality of implementation
demands preserving the sign. Disable this test until fixed
glibc is more prevalent. */
0 on negative underflow, even though quality of implementation
demands preserving the sign. Disable this test until fixed
glibc is more prevalent. */
- ASSERT (!!signbit (result) == !!signbit (-
0.0
)); /* glibc-2.3.6, mingw */
+ ASSERT (!!signbit (result) == !!signbit (-
zero
)); /* glibc-2.3.6, mingw */
#endif
ASSERT (ptr == input + 10);
ASSERT (errno == ERANGE);
#endif
ASSERT (ptr == input + 10);
ASSERT (errno == ERANGE);
@@
-903,7
+910,7
@@
main ()
errno = 0;
result = strtod (input, &ptr);
ASSERT (result == 0.0);
errno = 0;
result = strtod (input, &ptr);
ASSERT (result == 0.0);
- ASSERT (!!signbit (result) == !!signbit (-
0.0
)); /* IRIX 6.5, OSF/1 4.0 */
+ ASSERT (!!signbit (result) == !!signbit (-
zero
)); /* IRIX 6.5, OSF/1 4.0 */
ASSERT (ptr == input + m);
ASSERT (errno == 0);
}
ASSERT (ptr == input + m);
ASSERT (errno == 0);
}