[Piglit] [PATCH] util-cl: Fix error output from piglit_cl_probe_floating()

Tom Stellard tom at stellard.net
Thu Feb 7 14:53:31 PST 2013


From: Tom Stellard <thomas.stellard at amd.com>

- Print 16 decimal places of floating point values
- Fix the hex formatting
---

I sent out the wrong patch out last time.

tests/util/piglit-util-cl.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
index 3bc1c82..909058c 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -69,9 +69,15 @@ piglit_cl_probe_floating(double value, double expect, double tolerance)
 	diff = value > expect ? value-expect : expect-value;
 
 	if(diff > tolerance || isnan(value)) {
-		printf("Expecting %f (0x%"PRIx64") with tolerance %f, but got %f (0x%"
+		union {
+			double d;
+			uint64_t i;
+		} u_expect, u_value;
+		u_expect.d = expect;
+		u_value.d = value;
+		printf("Expecting %.16f (0x%"PRIx64") with tolerance %f, but got %.16f (0x%"
 		       PRIx64")\n",
-		       expect, (uint64_t)expect, tolerance, value, (uint64_t)value);
+		       expect, u_expect.i, tolerance, value, u_value.i);
 		return false;
 	}
 
-- 
1.7.8.6



More information about the Piglit mailing list