diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-07-03 14:41:12 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-07-03 14:41:12 -0400 |
commit | 5d71c5df484a72831fa35f9aaae0cd81d32e8f67 (patch) | |
tree | decf184c8b2a9447485be0379561cd81f080a9d3 | |
parent | f132998ec075e3c96332b519a8b6e058db047814 (diff) | |
download | vecmathlib-5d71c5df484a72831fa35f9aaae0cd81d32e8f67.zip vecmathlib-5d71c5df484a72831fa35f9aaae0cd81d32e8f67.tar.gz |
Allow specifying the maximum allowed error (in terms of ulp)
-rw-r--r-- | test.cc | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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); + } |