Source-Changes-HG archive

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

[src/trunk]: src/lib/libm/noieee_src PR/50660: David Binderman: bad calls to ...



details:   https://anonhg.NetBSD.org/src/rev/384107753a20
branches:  trunk
changeset: 813116:384107753a20
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 16 19:44:05 2016 +0000

description:
PR/50660: David Binderman: bad calls to printf, in test part

diffstat:

 lib/libm/noieee_src/n_fmod.c |  20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r 47aa3bdb7516 -r 384107753a20 lib/libm/noieee_src/n_fmod.c
--- a/lib/libm/noieee_src/n_fmod.c      Sat Jan 16 19:28:36 2016 +0000
+++ b/lib/libm/noieee_src/n_fmod.c      Sat Jan 16 19:44:05 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: n_fmod.c,v 1.7 2013/11/22 10:59:31 martin Exp $        */
+/*     $NetBSD: n_fmod.c,v 1.8 2016/01/16 19:44:05 christos Exp $      */
 /*
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -116,16 +116,26 @@
 #define        NCASES  3
 
 static int nfail = 0;
+static void
+prf(const char *s, double d)
+{
+       union {
+               double d;
+               unsigned long long u;
+       } x;
+       x.d = d;
+       printf("%s = %#016.16llx (%24.16e)\n:, s, x.u, x.d);
+}
 
 static void
 doit(double x, double y)
 {
        double ro = fmod(x,y),rn = _fmod(x,y);
        if (ro != rn) {
-               (void)printf(" x    = 0x%08.8x %08.8x (%24.16e)\n",x,x);
-               (void)printf(" y    = 0x%08.8x %08.8x (%24.16e)\n",y,y);
-               (void)printf(" fmod = 0x%08.8x %08.8x (%24.16e)\n",ro,ro);
-               (void)printf("_fmod = 0x%08.8x %08.8x (%24.16e)\n",rn,rn);
+               prf(" x   ", x);
+               prf(" y   ", y);
+               prf(" fmod", ro);
+               prf("_fmod", rn);
                (void)printf("\n");
        }
 }



Home | Main Index | Thread Index | Old Index