summaryrefslogtreecommitdiff
path: root/tests/lib/libc/stdlib
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2011-07-04 22:33:29 +0000
committermrg <mrg@NetBSD.org>2011-07-04 22:33:29 +0000
commitcaffe995bd293356f6a467aa0f9ab164a314c503 (patch)
tree24b0b6315fdc6b9f63dddd84be10f9a4cddca30d /tests/lib/libc/stdlib
parentc4e03f9f4f4e6ecd0506ee00a40dc3fdcddb0a29 (diff)
XXX: ugly hack to make these valid for vax fp.
XXX: could consolidate some of this into a common header, but i'll leave that clean up for another time.
Diffstat (limited to 'tests/lib/libc/stdlib')
-rw-r--r--tests/lib/libc/stdlib/t_strtod.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/lib/libc/stdlib/t_strtod.c b/tests/lib/libc/stdlib/t_strtod.c
index dce6cee1429..76c8322444d 100644
--- a/tests/lib/libc/stdlib/t_strtod.c
+++ b/tests/lib/libc/stdlib/t_strtod.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strtod.c,v 1.21 2011/06/14 02:37:31 jruoho Exp $ */
+/* $NetBSD: t_strtod.c,v 1.22 2011/07/04 22:33:29 mrg Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
/* Public domain, Otto Moerbeek <otto@drijf.net>, 2006. */
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_strtod.c,v 1.21 2011/06/14 02:37:31 jruoho Exp $");
+__RCSID("$NetBSD: t_strtod.c,v 1.22 2011/07/04 22:33:29 mrg Exp $");
#include <errno.h>
#include <math.h>
@@ -82,6 +82,12 @@ ATF_TC_HEAD(strtod_hex, tc)
atf_tc_set_md_var(tc, "descr", "A strtod(3) with hexadecimals");
}
+#ifdef __vax__
+#define SMALL_NUM 1.0e-38
+#else
+#define SMALL_NUM 1.0e-40
+#endif
+
ATF_TC_BODY(strtod_hex, tc)
{
const char *str;
@@ -93,14 +99,14 @@ ATF_TC_BODY(strtod_hex, tc)
ATF_REQUIRE(end == str + 4);
ATF_REQUIRE(signbit(d) != 0);
- ATF_REQUIRE(fabs(d) < 1.0e-40);
+ ATF_REQUIRE(fabs(d) < SMALL_NUM);
str = "-0x";
d = strtod(str, &end); /* -0.0 */
ATF_REQUIRE(end == str + 2);
ATF_REQUIRE(signbit(d) != 0);
- ATF_REQUIRE(fabs(d) < 1.0e-40);
+ ATF_REQUIRE(fabs(d) < SMALL_NUM);
}
ATF_TC(strtod_inf);