From 5d71c5df484a72831fa35f9aaae0cd81d32e8f67 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 3 Jul 2013 14:41:12 -0400 Subject: Allow specifying the maximum allowed error (in terms of ulp) --- test.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test.cc b/test.cc index cb18e28..d3f66ff 100644 --- a/test.cc +++ b/test.cc @@ -44,13 +44,20 @@ struct vecmathlib_test { // Test each function with this many random values static const int imax = 10000; + static real_t accuracy(real_t ulp = R(0.5)) + { #ifdef VML_HAVE_FP_CONTRACT - // Require that 95% of the digits are correct - static real_t accuracy() { return pow(realvec_t::epsilon(), R(0.95)); } + // Require that 100% of the digits are correct + // real_t digit_fraction = 1.0; + // We can't do that yet -- require fewer digits + real_t digit_fraction = 0.9; #else - // Require that 75% of the digits are correct - static real_t accuracy() { return pow(realvec_t::epsilon(), R(0.75)); } + // Require that 80% of the digits are correct + real_t digit_fraction = 0.8; #endif + digit_fraction *= 0.95; // some lenience for testing (why?) + return pow(ulp * realvec_t::epsilon(), digit_fraction); + } -- cgit v1.1