diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-01-28 15:13:55 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-01-28 15:13:55 -0500 |
commit | 9dc3abf247b620d0929e01a1b61827ec121a3b73 (patch) | |
tree | 362c991987c2baed63b4bd9fcb2ff98bf6fd7dfe /test.cc | |
parent | 0f3d4d8da23a3a6b1c057e9bc9f081629e0dfc9d (diff) | |
download | vecmathlib-9dc3abf247b620d0929e01a1b61827ec121a3b73.zip vecmathlib-9dc3abf247b620d0929e01a1b61827ec121a3b73.tar.gz |
Avoid corner cases when testing tan()
Diffstat (limited to 'test.cc')
-rw-r--r-- | test.cc | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -325,6 +325,9 @@ struct vecmathlib_test { realvec_t const fn = vecmathlib::convert_float(n); check("pow", pow, vecmathlib::pow, RV(0.0), y, accuracy); check("pow", pow, vecmathlib::pow, x, RV(0.0), accuracy); + // just to check + check("log", log, vecmathlib::log, x, accuracy); + check("pow", pow, vecmathlib::pow, x, y, accuracy); check("pow", pow, vecmathlib::pow, x, y, accuracy); check("pow", pow, vecmathlib::pow, -x, fn, accuracy); } @@ -360,7 +363,13 @@ struct vecmathlib_test { realvec_t const x = random(R(-10.0), R(+10.0)); check("sin", sin, vecmathlib::sin, x, accuracy); check("cos", cos, vecmathlib::cos, x, accuracy); - // tan loses accuracy (by definition, not by implementation?) + } + for (int i=0; i<imax; ++i) { + realvec_t const x0 = random(R(-1.55), R(+1.55)); + intvec_t const n = random(I(-10), I(+10)); + realvec_t const x = x0 + vecmathlib::convert_float(n) * RV(M_PI); + // tan loses accuracy near pi/2 + // (by definition, not by implementation?) check("tan", tan, vecmathlib::tan, x, R(100.0)*accuracy); } } |