diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-07-03 14:40:41 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-07-03 14:40:41 -0400 |
commit | d203d0e438cc0ea99f2eb6aabb45c9c82edfde5b (patch) | |
tree | 971c82675cf7a9247af9dcf77360abff2859ac4d | |
parent | 5492d72c249bebdb9e76ef80dd724ddde8215cdd (diff) | |
download | vecmathlib-d203d0e438cc0ea99f2eb6aabb45c9c82edfde5b.zip vecmathlib-d203d0e438cc0ea99f2eb6aabb45c9c82edfde5b.tar.gz |
Take maximum vector element into account when testing vector reductions
-rw-r--r-- | test.cc | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -467,7 +467,11 @@ struct vecmathlib_test { const real_t accuracy) { const real_t dr = rstd - rvml; - const real_t scale = fabs(rstd) + fabs(rvml) + R(1.0); + real_t maxabs = 0.0; + for (int i=0; i<realvec_t::size; ++i) { + maxabs = fmax(maxabs, fabs(x[i])); + } + const real_t scale = fabs(rstd) + fabs(rvml) + fabs(maxabs) + R(1.0); const bool isbad = fabs(dr) > accuracy * scale; if (isbad) { ++ num_errors; |