summaryrefslogtreecommitdiffstats
path: root/test.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-02-16 23:37:38 -0500
committerErik Schnetter <schnetter@gmail.com>2013-02-16 23:37:38 -0500
commit68fc04ed1826328d357a7c6402b10ae89aa8f059 (patch)
treefe290c5ba3cb6744b403bda6a82c6b8fd0ed7628 /test.cc
parent3dd2cd307b3795e7061fa1ff715903764b35df61 (diff)
downloadvecmathlib-68fc04ed1826328d357a7c6402b10ae89aa8f059.zip
vecmathlib-68fc04ed1826328d357a7c6402b10ae89aa8f059.tar.gz
Add cbrt, hypot, trunc; rename scalbn to ldexp
Diffstat (limited to 'test.cc')
-rw-r--r--test.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/test.cc b/test.cc
index 3430618..aef634f 100644
--- a/test.cc
+++ b/test.cc
@@ -369,10 +369,10 @@ struct vecmathlib_test {
// Change signature: "int" -> "int_t"
static int_t ilogb(real_t x) { return std::ilogb(x); }
- static real_t scalbn(real_t x, int_t n) { return std::scalbn(x, n); }
+ static real_t ldexp(real_t x, int_t n) { return std::ldexp(x, n); }
static void test_fabs()
{
- cout << " testing copysign fabs fdim fma fmax fmin ilogb isfinite isinf isnan isnormal scalbn signbit...\n" << flush;
+ cout << " testing copysign fabs fdim fma fmax fmin ilogb isfinite isinf isnan isnormal ldexp signbit...\n" << flush;
for (int i=0; i<imax; ++i) {
realvec_t const x = random(R(-10.0), R(+10.0));
realvec_t const y = random(R(-10.0), R(+10.0));
@@ -389,7 +389,7 @@ struct vecmathlib_test {
check("isinf", isinf, vecmathlib::isinf, x);
check("isnan", isnan, vecmathlib::isnan, x);
check("isnormal", isnormal, vecmathlib::isnormal, x);
- check("scalbn", scalbn, vecmathlib::scalbn, x, n, 0.0);
+ check("ldexp", ldexp, vecmathlib::ldexp, x, n, 0.0);
check("signbit", signbit, vecmathlib::signbit, x);
}
}
@@ -419,6 +419,9 @@ struct vecmathlib_test {
check("round", round, vecmathlib::round, x, accuracy());
check("round", round, vecmathlib::round, fn1, accuracy());
check("round", round, vecmathlib::round, fn2, accuracy());
+ check("trunc", trunc, vecmathlib::trunc, x, accuracy());
+ check("trunc", trunc, vecmathlib::trunc, fn1, accuracy());
+ check("trunc", trunc, vecmathlib::trunc, fn2, accuracy());
}
}
@@ -558,6 +561,10 @@ struct vecmathlib_test {
cout << " testing rsqrt sqrt...\n" << flush;
for (int i=0; i<imax; ++i) {
realvec_t const x = random(R(0.0), R(1.0e+3));
+ realvec_t const y = random(-R(1.0e+3), R(1.0e+3));
+ realvec_t const z = random(-R(1.0e+3), R(1.0e+3));
+ check("cbrt", cbrt, vecmathlib::cbrt, x, accuracy());
+ check("hypot", hypot, vecmathlib::hypot, y, z, accuracy());
check("rsqrt", rsqrt, vecmathlib::rsqrt, x, accuracy());
check("sqrt", sqrt, vecmathlib::sqrt, x, accuracy());
}
OpenPOWER on IntegriCloud