Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libm Check that the result isn't equaly to the exp...



details:   https://anonhg.NetBSD.org/src/rev/5d4b7b664de7
branches:  trunk
changeset: 327776:5d4b7b664de7
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Mar 16 18:42:21 2014 +0000

description:
Check that the result isn't equaly to the expected value before checking
  the absolute size of the error term.
If the expected result is +/-infinity it should compare equal, but the
  result of the subtract may not be zero.
Also print the result and error values in fp hex to make it easier to
  see how may lsb bits are incorrect.

diffstat:

 tests/lib/libm/t_libm.h |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r 05d2602c97b8 -r 5d4b7b664de7 tests/lib/libm/t_libm.h
--- a/tests/lib/libm/t_libm.h   Sun Mar 16 18:04:56 2014 +0000
+++ b/tests/lib/libm/t_libm.h   Sun Mar 16 18:42:21 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_libm.h,v 1.3 2014/03/07 12:46:47 martin Exp $ */
+/* $NetBSD: t_libm.h,v 1.4 2014/03/16 18:42:21 dsl Exp $ */
 
 /*
  * Check result of fn(arg) is correct within the bounds.
@@ -7,10 +7,10 @@
 #define T_LIBM_CHECK(subtest, fn, arg, expect, epsilon) do { \
        double r = fn(arg); \
        double e = fabs(r - expect); \
-       if (e > epsilon) \
+       if (r != expect && e > epsilon) \
                atf_tc_fail_nonfatal( \
-                   "subtest %u: " #fn "(%g) is %g not %g (error %g > %g)", \
-                   subtest, arg, r, expect, e, epsilon); \
+                   "subtest %u: " #fn "(%g) is %g (%.13a) not %g (%.13a), error %g (%.6a) > %g", \
+                   subtest, arg, r, r, expect, expect, e, e, epsilon); \
     } while (0)
 
 /* Check that the result of fn(arg) is NaN */



Home | Main Index | Thread Index | Old Index