Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libm Print the result as a 'long double' - on i386...



details:   https://anonhg.NetBSD.org/src/rev/3c6442e8563a
branches:  trunk
changeset: 794519:3c6442e8563a
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Mar 16 22:49:27 2014 +0000

description:
Print the result as a 'long double' - on i386 a return value that
should be infinity might just be too large for 'double' and won't
get converted until it has to be saved to memory.

diffstat:

 tests/lib/libm/t_libm.h |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r eb2f43a0134a -r 3c6442e8563a tests/lib/libm/t_libm.h
--- a/tests/lib/libm/t_libm.h   Sun Mar 16 22:44:48 2014 +0000
+++ b/tests/lib/libm/t_libm.h   Sun Mar 16 22:49:27 2014 +0000
@@ -1,15 +1,18 @@
-/* $NetBSD: t_libm.h,v 1.4 2014/03/16 18:42:21 dsl Exp $ */
+/* $NetBSD: t_libm.h,v 1.5 2014/03/16 22:49:27 dsl Exp $ */
 
 /*
  * Check result of fn(arg) is correct within the bounds.
  * Should be ok to do the checks using 'double' for 'float' functions.
+ * On i386 float and double values are returned on the x87 stack and might
+ * be out of range for the function - so save and print as 'long double'.
+ * (otherwise you can get 'inf != inf' reported!)
  */
 #define T_LIBM_CHECK(subtest, fn, arg, expect, epsilon) do { \
-       double r = fn(arg); \
+       long double r = fn(arg); \
        double e = fabs(r - expect); \
        if (r != expect && e > epsilon) \
                atf_tc_fail_nonfatal( \
-                   "subtest %u: " #fn "(%g) is %g (%.13a) not %g (%.13a), error %g (%.6a) > %g", \
+                   "subtest %u: " #fn "(%g) is %Lg (%.14La) not %g (%.13a), error %g (%.6a) > %g", \
                    subtest, arg, r, r, expect, expect, e, e, epsilon); \
     } while (0)
 



Home | Main Index | Thread Index | Old Index