Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libm Adjust to see where this fails on i386/qemu.



details:   https://anonhg.NetBSD.org/src/rev/d8b7892cf5dd
branches:  trunk
changeset: 769613:d8b7892cf5dd
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Sep 16 04:54:46 2011 +0000

description:
Adjust to see where this fails on i386/qemu.

diffstat:

 tests/lib/libm/t_ldexp.c |  24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diffs (62 lines):

diff -r dd49ea746806 -r d8b7892cf5dd tests/lib/libm/t_ldexp.c
--- a/tests/lib/libm/t_ldexp.c  Fri Sep 16 01:03:52 2011 +0000
+++ b/tests/lib/libm/t_ldexp.c  Fri Sep 16 04:54:46 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ldexp.c,v 1.7 2011/09/14 13:47:40 jruoho Exp $ */
+/* $NetBSD: t_ldexp.c,v 1.8 2011/09/16 04:54:46 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ldexp.c,v 1.7 2011/09/14 13:47:40 jruoho Exp $");
+__RCSID("$NetBSD: t_ldexp.c,v 1.8 2011/09/16 04:54:46 jruoho Exp $");
 
 #include <math.h>
 #include <limits.h>
@@ -51,13 +51,19 @@
 {
 #ifndef __vax__
        const double n[] = { 1, 2, 3, 25, 50, 100, 123, 321, 500 };
-       const double x = 12.1288221;
+       const double eps = 1.0e-40;
+       const double x = 12.0;
        double y;
        size_t i;
 
        for (i = 0; i < __arraycount(n); i++) {
+
                y = ldexp(x, n[i]);
-               ATF_CHECK(y == x * exp2(n[i]));
+
+               if (fabs(y - (x * exp2(n[i]))) > eps) {
+                       atf_tc_fail_nonfatal("ldexp(%0.01f, %0.01f) "
+                           "!= %0.01f * exp2(%0.01f)", x, n[i], x, n[i]);
+               }
        }
 #endif
 }
@@ -178,13 +184,19 @@
 {
 #ifndef __vax__
        const float n[] = { 1, 2, 3, 25, 50, 100, 123, 321, 500 };
-       const float x = 12.1288221;
+       const float eps = 1.0e-9;
+       const float x = 12;
        float y;
        size_t i;
 
        for (i = 0; i < __arraycount(n); i++) {
+
                y = ldexpf(x, n[i]);
-               ATF_CHECK(y == x * exp2f(n[i]));
+
+               if (fabsf(y - (x * exp2f(n[i]))) > eps) {
+                       atf_tc_fail_nonfatal("ldexpf(%0.01f, %0.01f) "
+                           "!= %0.01f * exp2f(%0.01f)", x, n[i], x, n[i]);
+               }
        }
 #endif
 }



Home | Main Index | Thread Index | Old Index