diff --git a/tests/lib/libc/stdlib/t_strtod.c b/tests/lib/libc/stdlib/t_strtod.c index dce6cee14290..76c8322444dd 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 , 2006. */ #include -__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 #include @@ -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); diff --git a/tests/lib/libm/t_ceil.c b/tests/lib/libm/t_ceil.c index 6edb7e857ddc..20b5e3494db2 100644 --- a/tests/lib/libm/t_ceil.c +++ b/tests/lib/libm/t_ceil.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_ceil.c,v 1.3 2011/03/25 10:42:38 jruoho Exp $ */ +/* $NetBSD: t_ceil.c,v 1.4 2011/07/04 22:33:29 mrg Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_ceil.c,v 1.3 2011/03/25 10:42:38 jruoho Exp $"); +__RCSID("$NetBSD: t_ceil.c,v 1.4 2011/07/04 22:33:29 mrg Exp $"); #include #include @@ -42,6 +42,12 @@ ATF_TC_HEAD(ceil, tc) atf_tc_set_md_var(tc, "descr", "A basic test of ceil(3)"); } +#ifdef __vax__ +#define SMALL_NUM 1.0e-38 +#else +#define SMALL_NUM 1.0e-40 +#endif + ATF_TC_BODY(ceil, tc) { const int n = 10240; @@ -53,8 +59,8 @@ ATF_TC_BODY(ceil, tc) x = i + 0.999999999; y = i + 0.000000001; - ATF_REQUIRE(fabs(ceil(x) - (double)(i + 1)) < 1.0e-40); - ATF_REQUIRE(fabs(ceil(x) - (double)(i + 1)) < 1.0e-40); + ATF_REQUIRE(fabs(ceil(x) - (double)(i + 1)) < SMALL_NUM); + ATF_REQUIRE(fabs(ceil(x) - (double)(i + 1)) < SMALL_NUM); } } diff --git a/tests/lib/libm/t_floor.c b/tests/lib/libm/t_floor.c index 7ea154fca8cd..09e897c15e93 100644 --- a/tests/lib/libm/t_floor.c +++ b/tests/lib/libm/t_floor.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_floor.c,v 1.4 2011/03/25 10:42:38 jruoho Exp $ */ +/* $NetBSD: t_floor.c,v 1.5 2011/07/04 22:33:29 mrg Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_floor.c,v 1.4 2011/03/25 10:42:38 jruoho Exp $"); +__RCSID("$NetBSD: t_floor.c,v 1.5 2011/07/04 22:33:29 mrg Exp $"); #include #include @@ -43,6 +43,12 @@ ATF_TC_HEAD(floor, tc) atf_tc_set_md_var(tc, "descr", "A basic test of floor(3)"); } +#ifdef __vax__ +#define SMALL_NUM 1.0e-38 +#else +#define SMALL_NUM 1.0e-40 +#endif + ATF_TC_BODY(floor, tc) { const int n = 10240; @@ -60,8 +66,8 @@ ATF_TC_BODY(floor, tc) x = i + 0.999999999; y = i + 0.000000001; - ATF_REQUIRE(fabs(floor(x) - (double)i) < 1.0e-40); - ATF_REQUIRE(fabs(floor(y) - (double)i) < 1.0e-40); + ATF_REQUIRE(fabs(floor(x) - (double)i) < SMALL_NUM); + ATF_REQUIRE(fabs(floor(y) - (double)i) < SMALL_NUM); } } diff --git a/tests/lib/libm/t_round.c b/tests/lib/libm/t_round.c index 12cd58a469ea..a8fd2d567f03 100644 --- a/tests/lib/libm/t_round.c +++ b/tests/lib/libm/t_round.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_round.c,v 1.1 2011/04/08 06:49:21 jruoho Exp $ */ +/* $NetBSD: t_round.c,v 1.2 2011/07/04 22:33:29 mrg Exp $ */ #include #include @@ -13,6 +13,12 @@ #define VAL 0x0.7ffffffffffffcp0 #define VALF 0x0.7fffff8p0 +#ifdef __vax__ +#define SMALL_NUM 1.0e-38 +#else +#define SMALL_NUM 1.0e-40 +#endif + ATF_TC(round_dir); ATF_TC_HEAD(round_dir, tc) { @@ -27,14 +33,14 @@ ATF_TC_BODY(round_dir, tc) b = round(a); bf = roundf(af); - ATF_REQUIRE(fabs(b) < 1.0e-40); - ATF_REQUIRE(fabsf(bf) < 1.0e-40); + ATF_REQUIRE(fabs(b) < SMALL_NUM); + ATF_REQUIRE(fabsf(bf) < SMALL_NUM); c = round(-a); cf = roundf(-af); - ATF_REQUIRE(fabs(c) < 1.0e-40); - ATF_REQUIRE(fabsf(cf) < 1.0e-40); + ATF_REQUIRE(fabs(c) < SMALL_NUM); + ATF_REQUIRE(fabsf(cf) < SMALL_NUM); } ATF_TP_ADD_TCS(tp)