Module Name:    src
Committed By:   christos
Date:           Sat Jan 16 19:44:05 UTC 2016

Modified Files:
        src/lib/libm/noieee_src: n_fmod.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libm/noieee_src/n_fmod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libm/noieee_src/n_fmod.c
diff -u src/lib/libm/noieee_src/n_fmod.c:1.7 src/lib/libm/noieee_src/n_fmod.c:1.8
--- src/lib/libm/noieee_src/n_fmod.c:1.7	Fri Nov 22 05:59:31 2013
+++ src/lib/libm/noieee_src/n_fmod.c	Sat Jan 16 14:44:05 2016
@@ -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 @@ extern double fmod();
 #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");
 	}
 }

Reply via email to