summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--floatprops.h16
-rw-r--r--floattypes.h92
-rw-r--r--mathfuncs_sqrt.h4
-rw-r--r--test.cc181
-rw-r--r--vec_altivec_float4.h8
-rw-r--r--vec_avx_double4.h12
-rw-r--r--vec_avx_float8.h22
-rw-r--r--vec_pseudo.h106
-rw-r--r--vec_qpx_double4.h20
-rw-r--r--vec_sse_double1.h34
-rw-r--r--vec_sse_double2.h4
-rw-r--r--vec_sse_float1.h32
-rw-r--r--vec_sse_float4.h12
-rw-r--r--vec_test.h4
-rw-r--r--vec_vsx_double2.h4
15 files changed, 308 insertions, 243 deletions
diff --git a/floatprops.h b/floatprops.h
index e81d8d0..99fefbd 100644
--- a/floatprops.h
+++ b/floatprops.h
@@ -36,8 +36,8 @@ namespace vecmathlib {
template<>
struct floatprops<fp8> {
typedef fp8 real_t;
- typedef std::int8_t int_t;
- typedef std::uint8_t uint_t;
+ typedef vml_std::int8_t int_t;
+ typedef vml_std::uint8_t uint_t;
static char const* name() { return "fp8"; }
@@ -102,8 +102,8 @@ namespace vecmathlib {
template<>
struct floatprops<fp16> {
typedef fp16 real_t;
- typedef std::int16_t int_t;
- typedef std::uint16_t uint_t;
+ typedef vml_std::int16_t int_t;
+ typedef vml_std::uint16_t uint_t;
static char const* name() { return "fp16"; }
@@ -168,8 +168,8 @@ namespace vecmathlib {
template<>
struct floatprops<float>: std::numeric_limits<float> {
typedef float real_t;
- typedef std::int32_t int_t;
- typedef std::uint32_t uint_t;
+ typedef vml_std::int32_t int_t;
+ typedef vml_std::uint32_t uint_t;
static char const* name() { return "float"; }
@@ -229,8 +229,8 @@ namespace vecmathlib {
template<>
struct floatprops<double>: std::numeric_limits<double> {
typedef double real_t;
- typedef std::int64_t int_t;
- typedef std::uint64_t uint_t;
+ typedef vml_std::int64_t int_t;
+ typedef vml_std::uint64_t uint_t;
static char const* name() { return "double"; }
diff --git a/floattypes.h b/floattypes.h
index c0ae1a9..e1ce044 100644
--- a/floattypes.h
+++ b/floattypes.h
@@ -8,6 +8,15 @@
#include <cassert>
#include <cstdlib>
+
+
+#if ! (defined __clang__ || defined __gcc__)
+# define __builtin_unreachable() (assert(0))
+# define __builtin_expect(expr, val) (expr)
+#endif
+
+
+
// We expect either 199711L or 201103L
#if __cplusplus >= 201103L
// C++11 is supported, use it
@@ -15,6 +24,12 @@
#include <cmath>
#include <cstdint>
+namespace vml_std {
+ using namespace std;
+}
+
+
+
#else
// C++11 is not supported, work around the missing pieces
@@ -24,15 +39,13 @@
#include <math.h>
#include <stdint.h>
-
-
#define static_assert(cond, msg)
-#define __builtin_unreachable() (assert(0))
-// Make some type definitions from stdint.h available in std
-namespace std {
+namespace vml_std {
+
+ // Make some type definitions from stdint.h available in std
typedef ::uint8_t uint8_t;
typedef ::int8_t int8_t;
typedef ::uint16_t uint16_t;
@@ -41,12 +54,9 @@ namespace std {
typedef ::int32_t int32_t;
typedef ::uint64_t uint64_t;
typedef ::int64_t int64_t;
-}
-
-
-
-// Make some math functions from math.h available in std
-namespace std {
+
+
+
// Capture macros into functions, then undefine the macros
#ifndef isfinite
# error "isfinite is not a macro"
@@ -76,63 +86,105 @@ namespace std {
#undef isnormal
#undef signbit
+
+
+ // Make math functions from math.h available in vml_std
+ // (We could instead take some of them -- but not all -- from std.)
+
+ inline float acos(float x) { return ::acosf(x); }
inline float acosh(float x) { return ::acoshf(x); }
+ inline float asin(float x) { return ::asinf(x); }
inline float asinh(float x) { return ::asinhf(x); }
- inline float atanh(float x) { return ::atanh(x); }
+ inline float atan(float x) { return ::atanf(x); }
+ inline float atan2(float x, float y) { return ::atan2f(x, y); }
+ inline float atanh(float x) { return ::atanhf(x); }
inline float cbrt(float x) { return ::cbrtf(x); }
- // inline float ceil(float x) { return ::ceilf(x); }
+ inline float ceil(float x) { return ::ceilf(x); }
+ inline float cos(float x) { return ::cosf(x); }
+ inline float cosh(float x) { return ::coshf(x); }
inline float copysign(float x, float y) { return ::copysignf(x, y); }
+ inline float exp(float x) { return ::expf(x); }
inline float exp2(float x) { return ::exp2f(x); }
inline float expm1(float x) { return ::expm1f(x); }
+ inline float fabs(float x) { return ::fabsf(x); }
inline float fdim(float x, float y) { return ::fdimf(x, y); }
- // inline float floor(float x) { return ::floorf(x); }
+ inline float floor(float x) { return ::floorf(x); }
inline float fma(float x, float y, float z) { return ::fmaf(x, y, z); }
inline float fmax(float x, float y) { return ::fmaxf(x, y); }
inline float fmin(float x, float y) { return ::fminf(x, y); }
- // inline float frexp(float x, int* r) { return ::frexpf(x, r); }
+ inline float fmod(float x, float y) { return ::fmodf(x, y); }
+ inline float frexp(float x, int* r) { return ::frexpf(x, r); }
inline float hypot(float x, float y) { return ::hypotf(x, y); }
inline int ilogb(float x) { return ::ilogbf(x); }
inline bool isfinite(float x) { return libc_isfinite(x); }
inline bool isinf(float x) { return libc_isinf(x); }
inline bool isnan(float x) { return libc_isnan(x); }
inline bool isnormal(float x) { return libc_isnormal(x); }
+ inline float ldexp(float x, int n) { return ::ldexpf(x, n); }
+ inline float log(float x) { return ::logf(x); }
+ inline float log10(float x) { return ::log10f(x); }
inline float log1p(float x) { return ::log1pf(x); }
inline float log2(float x) { return ::log2f(x); }
inline float nextafter(float x, float y) { return ::nextafterf(x, y); }
+ inline float pow(float x, float y) { return ::powf(x, y); }
inline float remainder(float x, float y) { return ::remainderf(x, y); }
inline float rint(float x) { return ::rintf(x); }
inline float round(float x) { return ::roundf(x); }
inline bool signbit(float x) { return libc_signbit(x); }
+ inline float sin(float x) { return ::sinf(x); }
+ inline float sinh(float x) { return ::sinhf(x); }
+ inline float sqrt(float x) { return ::sqrtf(x); }
+ inline float tan(float x) { return ::tanf(x); }
+ inline float tanh(float x) { return ::tanhf(x); }
inline float trunc(float x) { return ::truncf(x); }
+ inline double acos(double x) { return ::acos(x); }
inline double acosh(double x) { return ::acosh(x); }
+ inline double asin(double x) { return ::asin(x); }
inline double asinh(double x) { return ::asinh(x); }
+ inline double atan(double x) { return ::atan(x); }
+ inline double atan2(double x, double y) { return ::atan2(x, y); }
inline double atanh(double x) { return ::atanh(x); }
inline double cbrt(double x) { return ::cbrt(x); }
- // inline double ceil(double x) { return ::ceil(x); }
+ inline double ceil(double x) { return ::ceil(x); }
+ inline double cos(double x) { return ::cos(x); }
+ inline double cosh(double x) { return ::cosh(x); }
inline double copysign(double x, double y) { return ::copysign(x, y); }
+ inline double exp(double x) { return ::exp(x); }
inline double exp2(double x) { return ::exp2(x); }
inline double expm1(double x) { return ::expm1(x); }
+ inline double fabs(double x) { return ::fabs(x); }
inline double fdim(double x, double y) { return ::fdim(x, y); }
- // inline double floor(double x) { return ::floor(x); }
+ inline double floor(double x) { return ::floor(x); }
inline double fma(double x, double y, double z) { return ::fma(x, y, z); }
inline double fmax(double x, double y) { return ::fmax(x, y); }
inline double fmin(double x, double y) { return ::fmin(x, y); }
- // inline double frexp(double x, int* r) { return ::frexp(x, r); }
+ inline double fmod(double x, double y) { return ::fmod(x, y); }
+ inline double frexp(double x, int* r) { return ::frexp(x, r); }
inline double hypot(double x, double y) { return ::hypot(x, y); }
inline int ilogb(double x) { return ::ilogb(x); }
inline bool isfinite(double x) { return libc_isfinite(x); }
inline bool isinf(double x) { return libc_isinf(x); }
inline bool isnan(double x) { return libc_isnan(x); }
inline bool isnormal(double x) { return libc_isnormal(x); }
+ inline double ldexp(double x, int n) { return ::ldexp(x, n); }
+ inline double log(double x) { return ::log(x); }
+ inline double log10(double x) { return ::log10(x); }
inline double log1p(double x) { return ::log1p(x); }
inline double log2(double x) { return ::log2(x); }
inline double nextafter(double x, double y) { return ::nextafter(x, y); }
+ inline double pow(double x, double y) { return ::pow(x, y); }
inline double remainder(double x, double y) { return ::remainder(x, y); }
inline double rint(double x) { return ::rint(x); }
inline double round(double x) { return ::round(x); }
inline bool signbit(double x) { return libc_signbit(x); }
+ inline double sin(double x) { return ::sin(x); }
+ inline double sinh(double x) { return ::sinh(x); }
+ inline double sqrt(double x) { return ::sqrt(x); }
+ inline double tan(double x) { return ::tan(x); }
+ inline double tanh(double x) { return ::tanh(x); }
inline double trunc(double x) { return ::trunc(x); }
+
}
#endif
@@ -143,12 +195,12 @@ namespace vecmathlib {
struct fp8 {
// 1 bit sign, 4 bits exponent, 3 bits mantissa
- std::uint8_t val;
+ vml_std::uint8_t val;
};
struct fp16 {
// 1 bit sign, 5 bits exponent, 10 bits mantissa
- std::uint16_t val;
+ vml_std::uint16_t val;
};
} // namespace vecmathlib
diff --git a/mathfuncs_sqrt.h b/mathfuncs_sqrt.h
index 9be05bf..97307d0 100644
--- a/mathfuncs_sqrt.h
+++ b/mathfuncs_sqrt.h
@@ -27,8 +27,8 @@ namespace vecmathlib {
// TODO: divide by M_SQRT2 if ilogb_x % 2 == 1 ?
#else
real_t correction =
- std::ldexp(R(FP::exponent_offset & 1 ? M_SQRT2 : 1.0),
- FP::exponent_offset >> 1);
+ vml_std::ldexp(R(FP::exponent_offset & 1 ? M_SQRT2 : 1.0),
+ FP::exponent_offset >> 1);
realvec_t r = lsr(x.as_int(), 1).as_float() * RV(correction);
#endif
diff --git a/test.cc b/test.cc
index 9c98464..a3d6549 100644
--- a/test.cc
+++ b/test.cc
@@ -508,7 +508,7 @@ struct vecmathlib_test {
const real_t dr = rstd - rvml;
real_t maxabs = 0.0;
for (int i=0; i<realvec_t::size; ++i) {
- maxabs = std::fmax(maxabs, std::fabs(x[i]));
+ maxabs = vml_std::fmax(maxabs, vml_std::fabs(x[i]));
}
const real_t scale = fabs(rstd) + fabs(rvml) + fabs(maxabs) + R(1.0);
const bool isbad = fabs(dr) > accuracy * scale;
@@ -1138,14 +1138,14 @@ struct vecmathlib_test {
static real_t local_frexp0(real_t x)
{
int r;
- return std::frexp(x, &r);
+ return vml_std::frexp(x, &r);
}
static int_t local_frexp1(real_t x)
{
- if (std::isinf(x)) return std::numeric_limits<int_t>::max();
- if (std::isnan(x)) return std::numeric_limits<int_t>::min();
+ if (vml_std::isinf(x)) return std::numeric_limits<int_t>::max();
+ if (vml_std::isnan(x)) return std::numeric_limits<int_t>::min();
int r;
- std::frexp(x, &r);
+ vml_std::frexp(x, &r);
return r;
}
static realvec_t local_vfrexp0(realvec_t x)
@@ -1162,9 +1162,9 @@ struct vecmathlib_test {
static int_t local_ilogb(real_t x)
{
if (x==R(0.0)) return std::numeric_limits<int_t>::min();
- if (std::isinf(x)) return std::numeric_limits<int_t>::max();
- if (std::isnan(x)) return std::numeric_limits<int_t>::min();
- return std::ilogb(x);
+ if (vml_std::isinf(x)) return std::numeric_limits<int_t>::max();
+ if (vml_std::isnan(x)) return std::numeric_limits<int_t>::min();
+ return vml_std::ilogb(x);
}
static real_t local_ldexp(real_t x, int_t n) { return ldexp(x, n); }
static void test_fabs()
@@ -1247,7 +1247,7 @@ struct vecmathlib_test {
{
real_t rstd = x[0];
for (int i=1; i<realvec_t::size; ++i) {
- rstd = std::fmax(rstd, x[i]);
+ rstd = vml_std::fmax(rstd, x[i]);
}
real_t rvml = vecmathlib::maxval(x);
check_real("maxval", rstd, rvml, x, R(0.0));
@@ -1255,7 +1255,7 @@ struct vecmathlib_test {
{
real_t rstd = x[0];
for (int i=1; i<realvec_t::size; ++i) {
- rstd = std::fmin(rstd, x[i]);
+ rstd = vml_std::fmin(rstd, x[i]);
}
real_t rvml = vecmathlib::minval(x);
check_real("minval", rstd, rvml, x, R(0.0));
@@ -1269,35 +1269,36 @@ struct vecmathlib_test {
check_bool<RV,RV>(">=", local_ge, local_vge, x, y);
check_real<RV,RV>("copysign",
- std::copysign, vecmathlib::copysign, x, y, 0.0);
- check_real<RV>("fabs", std::fabs, vecmathlib::fabs, x, 0.0);
- check_real<RV,RV>("fdim", std::fdim, vecmathlib::fdim, x, y, accuracy());
+ vml_std::copysign, vecmathlib::copysign, x, y, 0.0);
+ check_real<RV>("fabs", vml_std::fabs, vecmathlib::fabs, x, 0.0);
+ check_real<RV,RV>("fdim",
+ vml_std::fdim, vecmathlib::fdim, x, y, accuracy());
check_real<RV,RV,RV>("fma",
- std::fma, vecmathlib::fma,
+ vml_std::fma, vecmathlib::fma,
x, y, z, R(10.0)*accuracy());
- check_real<RV,RV>("fmax", std::fmax, vecmathlib::fmax, x, y, 0.0);
- check_real<RV,RV>("fmin", std::fmin, vecmathlib::fmin, x, y, 0.0);
+ check_real<RV,RV>("fmax", vml_std::fmax, vecmathlib::fmax, x, y, 0.0);
+ check_real<RV,RV>("fmin", vml_std::fmin, vecmathlib::fmin, x, y, 0.0);
check_real<RV>("frexp0", local_frexp0, local_vfrexp0, x, 0.0);
check_int<RV>("frexp1", local_frexp1, local_vfrexp1, x);
check_int<RV>("ilogb",
local_ilogb, (intvec_t(*)(realvec_t))vecmathlib::ilogb, x);
#if defined VML_HAVE_INF || defined VML_HAVE_NAN
- check_bool<RV>("isfinite", std::isfinite, vecmathlib::isfinite, x);
+ check_bool<RV>("isfinite", vml_std::isfinite, vecmathlib::isfinite, x);
#endif
#ifdef VML_HAVE_INF
- check_bool<RV>("isinf", std::isinf, vecmathlib::isinf, x);
+ check_bool<RV>("isinf", vml_std::isinf, vecmathlib::isinf, x);
#endif
#ifdef VML_HAVE_NAN
- check_bool<RV>("isnan", std::isnan, vecmathlib::isnan, x);
+ check_bool<RV>("isnan", vml_std::isnan, vecmathlib::isnan, x);
#endif
#ifdef VML_HAVE_DENORMALS
- check_bool<RV>("isnormal", std::isnormal, vecmathlib::isnormal, x);
+ check_bool<RV>("isnormal", vml_std::isnormal, vecmathlib::isnormal, x);
#endif
check_real<RV,I>("ldexp", local_ldexp, vecmathlib::ldexp, x, n[0], 0.0);
check_real<RV,IV>("ldexp", local_ldexp, vecmathlib::ldexp, x, n, 0.0);
check_real<RV,RV>("nextafter",
- std::nextafter, vecmathlib::nextafter, x, y, 0.0);
- check_bool<RV>("signbit", std::signbit, vecmathlib::signbit, x);
+ vml_std::nextafter, vecmathlib::nextafter, x, y, 0.0);
+ check_bool<RV>("signbit", vml_std::signbit, vecmathlib::signbit, x);
}
}
@@ -1368,41 +1369,39 @@ struct vecmathlib_test {
const realvec_t fn1h = vecmathlib::convert_float(n1) * RV(0.25);
const realvec_t fn2h = vecmathlib::convert_float(n2) * RV(0.25);
check_real<IV>("convert_float",
- FP::convert_float, vecmathlib::convert_float,
- n1, accuracy());
+ FP::convert_float, vecmathlib::convert_float, n1, R(0.0));
check_real<IV>("convert_float",
- FP::convert_float, vecmathlib::convert_float,
- n2, accuracy());
+ FP::convert_float, vecmathlib::convert_float, n2, R(0.0));
// Note: RV(int_max) > int_max due to rounding
if (all(x >= RV(int_min) && x < RV(int_max))) {
check_int<RV>("convert_int",
FP::convert_int, vecmathlib::convert_int, x);
}
- check_real<RV>("ceil", std::ceil, vecmathlib::ceil, x, accuracy());
- check_real<RV>("ceil", std::ceil, vecmathlib::ceil, fn1, accuracy());
- check_real<RV>("ceil", std::ceil, vecmathlib::ceil, fn2, accuracy());
- check_real<RV>("ceil", std::ceil, vecmathlib::ceil, fn1h, accuracy());
- check_real<RV>("ceil", std::ceil, vecmathlib::ceil, fn2h, accuracy());
- check_real<RV>("floor", std::floor, vecmathlib::floor, x, accuracy());
- check_real<RV>("floor", std::floor, vecmathlib::floor, fn1, accuracy());
- check_real<RV>("floor", std::floor, vecmathlib::floor, fn2, accuracy());
- check_real<RV>("floor", std::floor, vecmathlib::floor, fn1h, accuracy());
- check_real<RV>("floor", std::floor, vecmathlib::floor, fn2h, accuracy());
- check_real<RV>("rint", std::rint, vecmathlib::rint, x, accuracy());
- check_real<RV>("rint", std::rint, vecmathlib::rint, fn1, accuracy());
- check_real<RV>("rint", std::rint, vecmathlib::rint, fn2, accuracy());
- check_real<RV>("rint", std::rint, vecmathlib::rint, fn1h, accuracy());
- check_real<RV>("rint", std::rint, vecmathlib::rint, fn2h, accuracy());
- check_real<RV>("round", std::round, vecmathlib::round, x, accuracy());
- check_real<RV>("round", std::round, vecmathlib::round, fn1, accuracy());
- check_real<RV>("round", std::round, vecmathlib::round, fn2, accuracy());
- check_real<RV>("round", std::round, vecmathlib::round, fn1h, accuracy());
- check_real<RV>("round", std::round, vecmathlib::round, fn2h, accuracy());
- check_real<RV>("trunc", std::trunc, vecmathlib::trunc, x, accuracy());
- check_real<RV>("trunc", std::trunc, vecmathlib::trunc, fn1, accuracy());
- check_real<RV>("trunc", std::trunc, vecmathlib::trunc, fn2, accuracy());
- check_real<RV>("trunc", std::trunc, vecmathlib::trunc, fn1h, accuracy());
- check_real<RV>("trunc", std::trunc, vecmathlib::trunc, fn2h, accuracy());
+ check_real<RV>("ceil", vml_std::ceil, vecmathlib::ceil, x, R(0.0));
+ check_real<RV>("ceil", vml_std::ceil, vecmathlib::ceil, fn1, R(0.0));
+ check_real<RV>("ceil", vml_std::ceil, vecmathlib::ceil, fn2, R(0.0));
+ check_real<RV>("ceil", vml_std::ceil, vecmathlib::ceil, fn1h, R(0.0));
+ check_real<RV>("ceil", vml_std::ceil, vecmathlib::ceil, fn2h, R(0.0));
+ check_real<RV>("floor", vml_std::floor, vecmathlib::floor, x, R(0.0));
+ check_real<RV>("floor", vml_std::floor, vecmathlib::floor, fn1, R(0.0));
+ check_real<RV>("floor", vml_std::floor, vecmathlib::floor, fn2, R(0.0));
+ check_real<RV>("floor", vml_std::floor, vecmathlib::floor, fn1h, R(0.0));
+ check_real<RV>("floor", vml_std::floor, vecmathlib::floor, fn2h, R(0.0));
+ check_real<RV>("rint", vml_std::rint, vecmathlib::rint, x, R(0.0));
+ check_real<RV>("rint", vml_std::rint, vecmathlib::rint, fn1, R(0.0));
+ check_real<RV>("rint", vml_std::rint, vecmathlib::rint, fn2, R(0.0));
+ check_real<RV>("rint", vml_std::rint, vecmathlib::rint, fn1h, R(0.0));
+ check_real<RV>("rint", vml_std::rint, vecmathlib::rint, fn2h, R(0.0));
+ check_real<RV>("round", vml_std::round, vecmathlib::round, x, R(0.0));
+ check_real<RV>("round", vml_std::round, vecmathlib::round, fn1, R(0.0));
+ check_real<RV>("round", vml_std::round, vecmathlib::round, fn2, R(0.0));
+ check_real<RV>("round", vml_std::round, vecmathlib::round, fn1h, R(0.0));
+ check_real<RV>("round", vml_std::round, vecmathlib::round, fn2h, R(0.0));
+ check_real<RV>("trunc", vml_std::trunc, vecmathlib::trunc, x, R(0.0));
+ check_real<RV>("trunc", vml_std::trunc, vecmathlib::trunc, fn1, R(0.0));
+ check_real<RV>("trunc", vml_std::trunc, vecmathlib::trunc, fn2, R(0.0));
+ check_real<RV>("trunc", vml_std::trunc, vecmathlib::trunc, fn1h, R(0.0));
+ check_real<RV>("trunc", vml_std::trunc, vecmathlib::trunc, fn2h, R(0.0));
}
}
@@ -1413,15 +1412,15 @@ struct vecmathlib_test {
cout << " testing asin acos atan atan2...\n" << flush;
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(-1.0), R(+1.0));
- check_real<RV>("asin", std::asin, vecmathlib::asin, x, accuracy(4));
- check_real<RV>("acos", std::acos, vecmathlib::acos, x, accuracy(4));
+ check_real<RV>("asin", vml_std::asin, vecmathlib::asin, x, accuracy(4));
+ check_real<RV>("acos", vml_std::acos, vecmathlib::acos, x, accuracy(4));
}
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(-100.0), R(+100.0));
const realvec_t y = random(R(-100.0), R(+100.0));
- check_real<RV>("atan", std::atan, vecmathlib::atan, x, accuracy(5));
+ check_real<RV>("atan", vml_std::atan, vecmathlib::atan, x, accuracy(5));
check_real<RV,RV>("atan2",
- std::atan2, vecmathlib::atan2, x, y, accuracy(6));
+ vml_std::atan2, vecmathlib::atan2, x, y, accuracy(6));
}
}
@@ -1430,15 +1429,18 @@ struct vecmathlib_test {
cout << " testing asinh acosh atanh...\n" << flush;
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(-1000.0), R(+1000.0));
- check_real<RV>("asinh", std::asinh, vecmathlib::asinh, x, accuracy(4));
+ check_real<RV>("asinh",
+ vml_std::asinh, vecmathlib::asinh, x, accuracy(4));
}
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(1.0), R(1000.0));
- check_real<RV>("acosh", std::acosh, vecmathlib::acosh, x, accuracy(4));
+ check_real<RV>("acosh",
+ vml_std::acosh, vecmathlib::acosh, x, accuracy(4));
}
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(-1.0), R(+1.0));
- check_real<RV>("atanh", std::atanh, vecmathlib::atanh, x, accuracy(5));
+ check_real<RV>("atanh",
+ vml_std::atanh, vecmathlib::atanh, x, accuracy(5));
}
}
@@ -1448,10 +1450,11 @@ struct vecmathlib_test {
cout << " testing exp exp10 exp2 expm1...\n" << flush;
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(-100.0), R(+100.0));
- check_real<RV>("exp", std::exp, vecmathlib::exp, x, accuracy(3));
+ check_real<RV>("exp", vml_std::exp, vecmathlib::exp, x, accuracy(3));
check_real<RV>("exp10", local_exp10, vecmathlib::exp10, x, accuracy(3));
- check_real<RV>("exp2", std::exp2, vecmathlib::exp2, x, accuracy(3));
- check_real<RV>("expm1", std::expm1, vecmathlib::expm1, x, accuracy(3));
+ check_real<RV>("exp2", vml_std::exp2, vecmathlib::exp2, x, accuracy(3));
+ check_real<RV>("expm1",
+ vml_std::expm1, vecmathlib::expm1, x, accuracy(3));
}
}
@@ -1460,10 +1463,12 @@ struct vecmathlib_test {
cout << " testing log log10 log1p log2...\n" << flush;
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(1.0e-10), R(1.0e+10));
- check_real<RV>("log", std::log, vecmathlib::log, x, accuracy(3));
- check_real<RV>("log10", std::log10, vecmathlib::log10, x, accuracy(3));
- check_real<RV>("log1p", std::log1p, vecmathlib::log1p, x, accuracy(2));
- check_real<RV>("log2", std::log2, vecmathlib::log2, x, accuracy(3));
+ check_real<RV>("log", vml_std::log, vecmathlib::log, x, accuracy(3));
+ check_real<RV>("log10",
+ vml_std::log10, vecmathlib::log10, x, accuracy(3));
+ check_real<RV>("log1p",
+ vml_std::log1p, vecmathlib::log1p, x, accuracy(2));
+ check_real<RV>("log2", vml_std::log2, vecmathlib::log2, x, accuracy(3));
}
}
@@ -1477,15 +1482,17 @@ struct vecmathlib_test {
const intvec_t n = random(I(-10), I(+10));
const realvec_t fn = vecmathlib::convert_float(n);
check_real<RV,RV>("pow(0,y)",
- std::pow, vecmathlib::pow, RV(0.0), ya, accuracy(16));
+ vml_std::pow, vecmathlib::pow, RV(0.0), ya,
+ accuracy(16));
check_real<RV,RV>("pow(x,0)",
- std::pow, vecmathlib::pow, x, RV(0.0), accuracy(16));
+ vml_std::pow, vecmathlib::pow, x, RV(0.0),
+ accuracy(16));
// just to check
- check_real<RV>("log(x)", std::log, vecmathlib::log, x, accuracy(3));
+ check_real<RV>("log(x)", vml_std::log, vecmathlib::log, x, accuracy(3));
check_real<RV,RV>("pow(x,y)",
- std::pow, vecmathlib::pow, x, y, accuracy(16));
+ vml_std::pow, vecmathlib::pow, x, y, accuracy(16));
check_real<RV,RV>("pow(-x,n)",
- std::pow, vecmathlib::pow, -x, fn, accuracy(16));
+ vml_std::pow, vecmathlib::pow, -x, fn, accuracy(16));
}
}
@@ -1504,19 +1511,22 @@ struct vecmathlib_test {
check_real<RV,RV>("/", local_div, local_div, x, y, accuracy());
check_real<RV>("rcp", local_rcp, vecmathlib::rcp, x, accuracy());
check_real<RV,RV>("fmod(x,y)",
- std::fmod, vecmathlib::fmod, x, y, 2.0*accuracy(), y);
+ vml_std::fmod, vecmathlib::fmod, x, y,
+ 2.0*accuracy(), y);
check_real<RV,RV>("fmod(x,m)",
- std::fmod, vecmathlib::fmod, x, fm, 2.0*accuracy(), fm);
+ vml_std::fmod, vecmathlib::fmod, x, fm,
+ 2.0*accuracy(), fm);
check_real<RV,RV>("fmod(n,y)",
- std::fmod, vecmathlib::fmod, fn, y, 2.0*accuracy(), y);
+ vml_std::fmod, vecmathlib::fmod, fn, y,
+ 2.0*accuracy(), y);
check_real<RV,RV>("remainder(x,y)",
- std::remainder, vecmathlib::remainder,
+ vml_std::remainder, vecmathlib::remainder,
x, y, R(2.0)*accuracy(), y);
check_real<RV,RV>("remainder(x,m)",
- std::remainder, vecmathlib::remainder,
+ vml_std::remainder, vecmathlib::remainder,
x, fm, R(2.0)*accuracy(), fm);
check_real<RV,RV>("remainder(n,y)",
- std::remainder, vecmathlib::remainder,
+ vml_std::remainder, vecmathlib::remainder,
fn, y, R(2.0)*accuracy(), y);
}
}
@@ -1526,8 +1536,8 @@ struct vecmathlib_test {
cout << " testing cos sin tan...\n" << flush;
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(-10.0), R(+10.0));
- check_real<RV>("sin", std::sin, vecmathlib::sin, x, accuracy(4));
- check_real<RV>("cos", std::cos, vecmathlib::cos, x, accuracy(4));
+ check_real<RV>("sin", vml_std::sin, vecmathlib::sin, x, accuracy(4));
+ check_real<RV>("cos", vml_std::cos, vecmathlib::cos, x, accuracy(4));
}
for (int i=0; i<imax; ++i) {
const realvec_t x0 = random(R(-1.55), R(+1.55));
@@ -1535,7 +1545,8 @@ struct vecmathlib_test {
const realvec_t x = x0 + vecmathlib::convert_float(n) * RV(M_PI);
// tan loses accuracy near pi/2
// (by definition, not by implementation?)
- check_real<RV>("tan", std::tan, vecmathlib::tan, x, R(20.0)*accuracy(5));
+ check_real<RV>("tan",
+ vml_std::tan, vecmathlib::tan, x, R(20.0)*accuracy(5));
}
}
@@ -1544,9 +1555,9 @@ struct vecmathlib_test {
cout << " testing cosh sinh tanh...\n" << flush;
for (int i=0; i<imax; ++i) {
const realvec_t x = random(R(-10.0), R(+10.0));
- check_real<RV>("sinh", std::sinh, vecmathlib::sinh, x, accuracy(4));
- check_real<RV>("cosh", std::cosh, vecmathlib::cosh, x, accuracy(4));
- check_real<RV>("tanh", std::tanh, vecmathlib::tanh, x, accuracy(5));
+ check_real<RV>("sinh", vml_std::sinh, vecmathlib::sinh, x, accuracy(4));
+ check_real<RV>("cosh", vml_std::cosh, vecmathlib::cosh, x, accuracy(4));
+ check_real<RV>("tanh", vml_std::tanh, vecmathlib::tanh, x, accuracy(5));
}
}
@@ -1558,11 +1569,11 @@ struct vecmathlib_test {
const realvec_t x = random(R(0.0), R(1.0e+3));
const realvec_t y = random(-R(1.0e+3), R(1.0e+3));
const realvec_t z = random(-R(1.0e+3), R(1.0e+3));
- check_real<RV>("cbrt", std::cbrt, vecmathlib::cbrt, x, accuracy());
+ check_real<RV>("cbrt", vml_std::cbrt, vecmathlib::cbrt, x, accuracy());
check_real<RV,RV>("hypot",
- std::hypot, vecmathlib::hypot, y, z, accuracy());
+ vml_std::hypot, vecmathlib::hypot, y, z, accuracy());
check_real<RV>("rsqrt", local_rsqrt, vecmathlib::rsqrt, x, accuracy());
- check_real<RV>("sqrt", std::sqrt, vecmathlib::sqrt, x, accuracy());
+ check_real<RV>("sqrt", vml_std::sqrt, vecmathlib::sqrt, x, accuracy());
}
}
diff --git a/vec_altivec_float4.h b/vec_altivec_float4.h
index 36f0281..c11d6ab 100644
--- a/vec_altivec_float4.h
+++ b/vec_altivec_float4.h
@@ -434,13 +434,13 @@ namespace vecmathlib {
real_t maxval() const
{
- return std::fmax(std::fmax((*this)[0], (*this)[1]),
- std::fmax((*this)[2], (*this)[3]));
+ return vml_std::fmax(vml_std::fmax((*this)[0], (*this)[1]),
+ vml_std::fmax((*this)[2], (*this)[3]));
}
real_t minval() const
{
- return std::fmin(std::fmin((*this)[0], (*this)[1]),
- std::fmin((*this)[2], (*this)[3]));
+ return vml_std::fmin(vml_std::fmin((*this)[0], (*this)[1]),
+ vml_std::fmin((*this)[2], (*this)[3]));
}
real_t prod() const
{
diff --git a/vec_avx_double4.h b/vec_avx_double4.h
index 28dce07..7460c12 100644
--- a/vec_avx_double4.h
+++ b/vec_avx_double4.h
@@ -531,21 +531,21 @@ namespace vecmathlib {
real_t maxval() const
{
- // return std::fmax(std::fmax((*this)[0], (*this)[1]),
- // std::fmax((*this)[2], (*this)[3]));
+ // return vml_std::fmax(vml_std::fmax((*this)[0], (*this)[1]),
+ // vml_std::fmax((*this)[2], (*this)[3]));
realvec_t x0123 = *this;
realvec_t x1032 = _mm256_shuffle_pd(x0123, x0123, 0b0101);
realvec_t y0022 = x0123.fmax(x1032);
- return std::fmax(y0022[0], y0022[2]);
+ return vml_std::fmax(y0022[0], y0022[2]);
}
real_t minval() const
{
- // return std::fmin(std::fmin((*this)[0], (*this)[1]),
- // std::fmin((*this)[2], (*this)[3]));
+ // return vml_std::fmin(vml_std::fmin((*this)[0], (*this)[1]),
+ // vml_std::fmin((*this)[2], (*this)[3]));
realvec_t x0123 = *this;
realvec_t x1032 = _mm256_shuffle_pd(x0123, x0123, 0b0101);
realvec_t y0022 = x0123.fmin(x1032);
- return std::fmin(y0022[0], y0022[2]);
+ return vml_std::fmin(y0022[0], y0022[2]);
}
real_t prod() const
{
diff --git a/vec_avx_float8.h b/vec_avx_float8.h
index e27c53e..6a8e4c4 100644
--- a/vec_avx_float8.h
+++ b/vec_avx_float8.h
@@ -508,29 +508,31 @@ namespace vecmathlib {
real_t maxval() const
{
- // return std::fmax(std::fmax(std::fmax((*this)[0], (*this)[1]),
- // std::fmax((*this)[2], (*this)[3])),
- // std::fmax(std::fmax((*this)[4], (*this)[5]),
- // std::fmax((*this)[6], (*this)[7])));
+ // return
+ // vml_std::fmax(vml_std::fmax(vml_std::fmax((*this)[0], (*this)[1]),
+ // vml_std::fmax((*this)[2], (*this)[3])),
+ // vml_std::fmax(vml_std::fmax((*this)[4], (*this)[5]),
+ // vml_std::fmax((*this)[6], (*this)[7])));
realvec_t x01234567 = *this;
realvec_t x10325476 = _mm256_shuffle_ps(x01234567, x01234567, 0b10110001);
realvec_t y00224466 = x01234567.fmax(x10325476);
realvec_t y22006644 = _mm256_shuffle_ps(y00224466, y00224466, 0b01001110);
realvec_t z00004444 = y00224466.fmax(y22006644);
- return std::fmax(z00004444[0], z00004444[4]);
+ return vml_std::fmax(z00004444[0], z00004444[4]);
}
real_t minval() const
{
- // return std::fmin(std::fmin(std::fmin((*this)[0], (*this)[1]),
- // std::fmin((*this)[2], (*this)[3])),
- // std::fmin(std::fmin((*this)[4], (*this)[5]),
- // std::fmin((*this)[6], (*this)[7])));
+ // return
+ // vml_std::fmin(vml_std::fmin(vml_std::fmin((*this)[0], (*this)[1]),
+ // vml_std::fmin((*this)[2], (*this)[3])),
+ // vml_std::fmin(vml_std::fmin((*this)[4], (*this)[5]),
+ // vml_std::fmin((*this)[6], (*this)[7])));
realvec_t x01234567 = *this;
realvec_t x10325476 = _mm256_shuffle_ps(x01234567, x01234567, 0b10110001);
realvec_t y00224466 = x01234567.fmin(x10325476);
realvec_t y22006644 = _mm256_shuffle_ps(y00224466, y00224466, 0b01001110);
realvec_t z00004444 = y00224466.fmin(y22006644);
- return std::fmin(z00004444[0], z00004444[4]);
+ return vml_std::fmin(z00004444[0], z00004444[4]);
}
real_t prod() const
{
diff --git a/vec_pseudo.h b/vec_pseudo.h
index 9e2d1e0..3b940fc 100644
--- a/vec_pseudo.h
+++ b/vec_pseudo.h
@@ -717,13 +717,13 @@ namespace vecmathlib {
real_t maxval() const
{
real_t res = v[0];
- for (int d=1; d<size; ++d) res = std::fmax(res, v[d]);
+ for (int d=1; d<size; ++d) res = vml_std::fmax(res, v[d]);
return res;
}
real_t minval() const
{
real_t res = v[0];
- for (int d=1; d<size; ++d) res = std::fmin(res, v[d]);
+ for (int d=1; d<size; ++d) res = vml_std::fmin(res, v[d]);
return res;
}
real_t prod() const
@@ -780,76 +780,76 @@ namespace vecmathlib {
- realpseudovec acos() const { return map(std::acos); }
- realpseudovec acosh() const { return map(std::acosh); }
- realpseudovec asin() const { return map(std::asin); }
- realpseudovec asinh() const { return map(std::asinh); }
- realpseudovec atan() const { return map(std::atan); }
+ realpseudovec acos() const { return map(vml_std::acos); }
+ realpseudovec acosh() const { return map(vml_std::acosh); }
+ realpseudovec asin() const { return map(vml_std::asin); }
+ realpseudovec asinh() const { return map(vml_std::asinh); }
+ realpseudovec atan() const { return map(vml_std::atan); }
realpseudovec atan2(realpseudovec y) const
{
return MF::vml_atan2(*this, y);
}
- realpseudovec atanh() const { return map(std::atanh); }
- realpseudovec cbrt() const { return map(std::cbrt); }
- realpseudovec ceil() const { return map(std::ceil); }
+ realpseudovec atanh() const { return map(vml_std::atanh); }
+ realpseudovec cbrt() const { return map(vml_std::cbrt); }
+ realpseudovec ceil() const { return map(vml_std::ceil); }
realpseudovec copysign(realpseudovec y) const
{
- return map(std::copysign, y);
+ return map(vml_std::copysign, y);
}
- realpseudovec cos() const { return map(std::cos); }
- realpseudovec cosh() const { return map(std::cosh); }
- realpseudovec exp() const { return map(std::exp); }
+ realpseudovec cos() const { return map(vml_std::cos); }
+ realpseudovec cosh() const { return map(vml_std::cosh); }
+ realpseudovec exp() const { return map(vml_std::exp); }
realpseudovec exp10() const
{
realvec_t res;
- for (int d=0; d<size; ++d) res.v[d] = std::exp(R(M_LN10) * v[d]);
+ for (int d=0; d<size; ++d) res.v[d] = vml_std::exp(R(M_LN10) * v[d]);
return res;
}
- realpseudovec exp2() const { return map(std::exp2); }
- realpseudovec expm1() const { return map(std::expm1); }
- realpseudovec fabs() const { return map(std::fabs); }
- realpseudovec fdim(realpseudovec y) const { return map(std::fdim, y); }
- realpseudovec floor() const { return map(std::floor); }
+ realpseudovec exp2() const { return map(vml_std::exp2); }
+ realpseudovec expm1() const { return map(vml_std::expm1); }
+ realpseudovec fabs() const { return map(vml_std::fabs); }
+ realpseudovec fdim(realpseudovec y) const { return map(vml_std::fdim, y); }
+ realpseudovec floor() const { return map(vml_std::floor); }
realpseudovec fma(realpseudovec y, realpseudovec z) const
{
- return map(std::fma, y, z);
+ return map(vml_std::fma, y, z);
}
- realpseudovec fmax(realpseudovec y) const { return map(std::fmax, y); }
- realpseudovec fmin(realpseudovec y) const { return map(std::fmin, y); }
- realpseudovec fmod(realpseudovec y) const { return map(std::fmod, y); }
+ realpseudovec fmax(realpseudovec y) const { return map(vml_std::fmax, y); }
+ realpseudovec fmin(realpseudovec y) const { return map(vml_std::fmin, y); }
+ realpseudovec fmod(realpseudovec y) const { return map(vml_std::fmod, y); }
realpseudovec frexp(intvec_t* ires) const
{
realvec_t res;
for (int d=0; d<size; ++d) {
int iri;
- real_t r = std::frexp(v[d], &iri);
+ real_t r = vml_std::frexp(v[d], &iri);
int_t ir = iri;
#if defined VML_HAVE_INF
- if (std::isinf(v[d])) ir = std::numeric_limits<int_t>::max();
+ if (vml_std::isinf(v[d])) ir = std::numeric_limits<int_t>::max();
#endif
#if defined VML_HAVE_NAN
- if (std::isnan(v[d])) ir = std::numeric_limits<int_t>::min();
+ if (vml_std::isnan(v[d])) ir = std::numeric_limits<int_t>::min();
#endif
res.v[d] = r;
ires->v[d] = ir;
}
return res;
}
- realpseudovec hypot(realpseudovec y) const { return map(std::hypot, y); }
+ realpseudovec hypot(realpseudovec y) const { return map(vml_std::hypot, y); }
intvec_t ilogb() const
{
intvec_t res;
for (int d=0; d<size; ++d) {
- int_t r = std::ilogb(v[d]);
+ int_t r = vml_std::ilogb(v[d]);
typedef std::numeric_limits<int_t> NL;
if (FP_ILOGB0 != NL::min() and v[d] == R(0.0)) {
r = NL::min();
#if defined VML_HAVE_INF
- } else if (INT_MAX != NL::max() and std::isinf(v[d])) {
+ } else if (INT_MAX != NL::max() and vml_std::isinf(v[d])) {
r = NL::max();
#endif
#if defined VML_HAVE_NAN
- } else if (FP_ILOGBNAN != NL::min() and std::isnan(v[d])) {
+ } else if (FP_ILOGBNAN != NL::min() and vml_std::isnan(v[d])) {
r = NL::min();
#endif
}
@@ -857,31 +857,31 @@ namespace vecmathlib {
}
return res;
}
- boolvec_t isfinite() const { return mapb(std::isfinite); }
- boolvec_t isinf() const { return mapb(std::isinf); }
- boolvec_t isnan() const { return mapb(std::isnan); }
- boolvec_t isnormal() const { return mapb(std::isnormal); }
+ boolvec_t isfinite() const { return mapb(vml_std::isfinite); }
+ boolvec_t isinf() const { return mapb(vml_std::isinf); }
+ boolvec_t isnan() const { return mapb(vml_std::isnan); }
+ boolvec_t isnormal() const { return mapb(vml_std::isnormal); }
realpseudovec ldexp(int_t n) const
{
realvec_t res;
- for (int d=0; d<size; ++d) res.v[d] = std::ldexp(v[d], n);
+ for (int d=0; d<size; ++d) res.v[d] = vml_std::ldexp(v[d], n);
return res;
}
realpseudovec ldexp(intvec_t n) const
{
realvec_t res;
- for (int d=0; d<size; ++d) res.v[d] = std::ldexp(v[d], n.v[d]);
+ for (int d=0; d<size; ++d) res.v[d] = vml_std::ldexp(v[d], n.v[d]);
return res;
}
- realpseudovec log() const { return map(std::log); }
- realpseudovec log10() const { return map(std::log10); }
- realpseudovec log1p() const { return map(std::log1p); }
- realpseudovec log2() const { return map(std::log2); }
+ realpseudovec log() const { return map(vml_std::log); }
+ realpseudovec log10() const { return map(vml_std::log10); }
+ realpseudovec log1p() const { return map(vml_std::log1p); }
+ realpseudovec log2() const { return map(vml_std::log2); }
realpseudovec nextafter(realpseudovec y) const
{
- return map(std::nextafter, y);
+ return map(vml_std::nextafter, y);
}
- realpseudovec pow(realpseudovec y) const { return map(std::pow, y); }
+ realpseudovec pow(realpseudovec y) const { return map(vml_std::pow, y); }
realpseudovec rcp() const
{
realvec_t res;
@@ -890,18 +890,18 @@ namespace vecmathlib {
}
realpseudovec remainder(realpseudovec y) const
{
- return map(std::remainder, y);
+ return map(vml_std::remainder, y);
}
- realpseudovec rint() const { return map(std::rint); }
- realpseudovec round() const { return map(std::round); }
+ realpseudovec rint() const { return map(vml_std::rint); }
+ realpseudovec round() const { return map(vml_std::round); }
realpseudovec rsqrt() const { return sqrt().rcp(); }
- boolvec_t signbit() const { return mapb(std::signbit); }
- realpseudovec sin() const { return map(std::sin); }
- realpseudovec sinh() const { return map(std::sinh); }
- realpseudovec sqrt() const { return map(std::sqrt); }
- realpseudovec tan() const { return map(std::tan); }
- realpseudovec tanh() const { return map(std::tanh); }
- realpseudovec trunc() const { return map(std::trunc); }
+ boolvec_t signbit() const { return mapb(vml_std::signbit); }
+ realpseudovec sin() const { return map(vml_std::sin); }
+ realpseudovec sinh() const { return map(vml_std::sinh); }
+ realpseudovec sqrt() const { return map(vml_std::sqrt); }
+ realpseudovec tan() const { return map(vml_std::tan); }
+ realpseudovec tanh() const { return map(vml_std::tanh); }
+ realpseudovec trunc() const { return map(vml_std::trunc); }
};
diff --git a/vec_qpx_double4.h b/vec_qpx_double4.h
index abbf085..5ed6a3e 100644
--- a/vec_qpx_double4.h
+++ b/vec_qpx_double4.h
@@ -528,21 +528,21 @@ namespace vecmathlib {
real_t maxval() const
{
- // return std::fmax(std::fmax((*this)[0], (*this)[1]),
- // std::fmax((*this)[2], (*this)[3]));
+ // return vml_std::fmax(vml_std::fmax((*this)[0], (*this)[1]),
+ // vml_std::fmax((*this)[2], (*this)[3]));
realvec_t x0123 = *this;
realvec_t x1032 = vec_perm(x0123, x0123, vec_gpci(01032));
realvec_t y0022 = x0123.fmax(x1032);
- return std::fmax(y0022[0], y0022[2]);
+ return vml_std::fmax(y0022[0], y0022[2]);
}
real_t minval() const
{
- // return std::fmin(std::fmin((*this)[0], (*this)[1]),
- // std::fmin((*this)[2], (*this)[3]));
+ // return vml_std::fmin(vml_std::fmin((*this)[0], (*this)[1]),
+ // vml_std::fmin((*this)[2], (*this)[3]));
realvec_t x0123 = *this;
realvec_t x1032 = vec_perm(x0123, x0123, vec_gpci(01032));
realvec_t y0022 = x0123.fmin(x1032);
- return std::fmin(y0022[0], y0022[2]);
+ return vml_std::fmin(y0022[0], y0022[2]);
}
real_t prod() const
{
@@ -637,10 +637,10 @@ namespace vecmathlib {
realvec ldexp(intvec_t n) const
{
real_t ldexp_[] = {
- std::ldexp((*this)[0], n[0]),
- std::ldexp((*this)[1], n[1]),
- std::ldexp((*this)[2], n[2]),
- std::ldexp((*this)[3], n[3])
+ vml_std::ldexp((*this)[0], n[0]),
+ vml_std::ldexp((*this)[1], n[1]),
+ vml_std::ldexp((*this)[2], n[2]),
+ vml_std::ldexp((*this)[3], n[3])
};
return realvec_t(ldexp_);
}
diff --git a/vec_sse_double1.h b/vec_sse_double1.h
index 7ec047c..d021e26 100644
--- a/vec_sse_double1.h
+++ b/vec_sse_double1.h
@@ -403,24 +403,24 @@ namespace vecmathlib {
#ifdef __SSE4_1__
return to_double(_mm_ceil_sd(from_double(v), from_double(v)));
#else
- return std::ceil(v);
+ return vml_std::ceil(v);
#endif
}
- realvec copysign(realvec y) const { return std::copysign(v, y.v); }
+ realvec copysign(realvec y) const { return vml_std::copysign(v, y.v); }
realvec cos() const { return MF::vml_cos(*this); }
realvec cosh() const { return MF::vml_cosh(*this); }
realvec exp() const { return MF::vml_exp(*this); }
realvec exp10() const { return MF::vml_exp10(*this); }
realvec exp2() const { return MF::vml_exp2(*this); }
realvec expm1() const { return MF::vml_expm1(*this); }
- realvec fabs() const { return std::fabs(v); }
+ realvec fabs() const { return vml_std::fabs(v); }
realvec fdim(realvec y) const { return MF::vml_fdim(*this, y); }
realvec floor() const
{
#ifdef __SSE4_1__
return to_double(_mm_floor_sd(from_double(v), from_double(v)));
#else
- return std::floor(v);
+ return vml_std::floor(v);
#endif
}
realvec fma(realvec y, realvec z) const { return MF::vml_fma(*this, y, z); }
@@ -432,11 +432,11 @@ namespace vecmathlib {
{
return to_double(_mm_min_sd(from_double(v), from_double(y.v)));
}
- realvec fmod(realvec y) const { return std::fmod(v, y.v); }
+ realvec fmod(realvec y) const { return vml_std::fmod(v, y.v); }
realvec frexp(intvec_t* irp) const
{
int iri;
- realvec r = std::frexp(v, &iri);
+ realvec r = vml_std::frexp(v, &iri);
int_t ir = iri;
if (isinf()) ir = std::numeric_limits<int_t>::max();
if (isnan()) ir = std::numeric_limits<int_t>::min();
@@ -446,23 +446,23 @@ namespace vecmathlib {
realvec hypot(realvec y) const { return MF::vml_hypot(*this, y); }
intvec_t ilogb() const
{
- int_t r = std::ilogb(v);
+ int_t r = vml_std::ilogb(v);
typedef std::numeric_limits<int_t> NL;
if (FP_ILOGB0 != NL::min() and v == R(0.0)) {
r = NL::min();
#if defined VML_HAVE_INF
- } else if (INT_MAX != NL::max() and std::isinf(v)) {
+ } else if (INT_MAX != NL::max() and vml_std::isinf(v)) {
r = NL::max();
#endif
#if defined VML_HAVE_NAN
- } else if (FP_ILOGBNAN != NL::min() and std::isnan(v)) {
+ } else if (FP_ILOGBNAN != NL::min() and vml_std::isnan(v)) {
r = NL::min();
#endif
}
return r;
}
- boolvec_t isfinite() const { return std::isfinite(v); }
- boolvec_t isinf() const { return std::isinf(v); }
+ boolvec_t isfinite() const { return vml_std::isfinite(v); }
+ boolvec_t isinf() const { return vml_std::isinf(v); }
boolvec_t isnan() const
{
// This is wrong:
@@ -472,11 +472,11 @@ namespace vecmathlib {
// __asm__("ucomisd %[v],%[v]; setp %[r]": [r]"=q"(r): [v]"x"(v));
// return boolvec_t::scalar_t(r);
// This works as well:
- return std::isnan(v);
+ return vml_std::isnan(v);
}
- boolvec_t isnormal() const { return std::isnormal(v); }
- realvec ldexp(int_t n) const { return std::ldexp(v, n); }
- realvec ldexp(intvec_t n) const { return std::ldexp(v, n); }
+ boolvec_t isnormal() const { return vml_std::isnormal(v); }
+ realvec ldexp(int_t n) const { return vml_std::ldexp(v, n); }
+ realvec ldexp(intvec_t n) const { return vml_std::ldexp(v, n); }
realvec log() const { return MF::vml_log(*this); }
realvec log10() const { return MF::vml_log10(*this); }
realvec log1p() const { return MF::vml_log1p(*this); }
@@ -484,7 +484,7 @@ namespace vecmathlib {
realvec nextafter(realvec y) const { return MF::vml_nextafter(*this, y); }
realvec pow(realvec y) const { return MF::vml_pow(*this, y); }
realvec rcp() const { return R(1.0)/v; }
- realvec remainder(realvec y) const { return std::remainder(v, y.v); }
+ realvec remainder(realvec y) const { return vml_std::remainder(v, y.v); }
realvec rint() const
{
#ifdef __SSE4_1__
@@ -496,7 +496,7 @@ namespace vecmathlib {
}
realvec round() const { return MF::vml_round(*this); }
realvec rsqrt() const { return MF::vml_rsqrt(*this); }
- boolvec_t signbit() const { return std::signbit(v); }
+ boolvec_t signbit() const { return vml_std::signbit(v); }
realvec sin() const { return MF::vml_sin(*this); }
realvec sinh() const { return MF::vml_sinh(*this); }
realvec sqrt() const
diff --git a/vec_sse_double2.h b/vec_sse_double2.h
index b7962e2..937f114 100644
--- a/vec_sse_double2.h
+++ b/vec_sse_double2.h
@@ -498,11 +498,11 @@ namespace vecmathlib {
real_t maxval() const
{
- return std::fmax((*this)[0], (*this)[1]);
+ return vml_std::fmax((*this)[0], (*this)[1]);
}
real_t minval() const
{
- return std::fmin((*this)[0], (*this)[1]);
+ return vml_std::fmin((*this)[0], (*this)[1]);
}
real_t prod() const
{
diff --git a/vec_sse_float1.h b/vec_sse_float1.h
index a5df06b..bfc90d9 100644
--- a/vec_sse_float1.h
+++ b/vec_sse_float1.h
@@ -400,24 +400,24 @@ namespace vecmathlib {
#ifdef __SSE4_1__
return to_float(_mm_ceil_ss(from_float(v), from_float(v)));
#else
- return std::ceil(v);
+ return vml_std::ceil(v);
#endif
}
- realvec copysign(realvec y) const { return std::copysign(v, y.v); }
+ realvec copysign(realvec y) const { return vml_std::copysign(v, y.v); }
realvec cos() const { return MF::vml_cos(*this); }
realvec cosh() const { return MF::vml_cosh(*this); }
realvec exp() const { return MF::vml_exp(*this); }
realvec exp10() const { return MF::vml_exp10(*this); }
realvec exp2() const { return MF::vml_exp2(*this); }
realvec expm1() const { return MF::vml_expm1(*this); }
- realvec fabs() const { return std::fabs(v); }
+ realvec fabs() const { return vml_std::fabs(v); }
realvec fdim(realvec y) const { return MF::vml_fdim(*this, y); }
realvec floor() const
{
#ifdef __SSE4_1__
return to_float(_mm_floor_ss(from_float(v), from_float(v)));
#else
- return std::floor(v);
+ return vml_std::floor(v);
#endif
}
realvec fma(realvec y, realvec z) const { return MF::vml_fma(*this, y, z); }
@@ -429,11 +429,11 @@ namespace vecmathlib {
{
return to_float(_mm_min_ss(from_float(v), from_float(y.v)));
}
- realvec fmod(realvec y) const { return std::fmod(v, y.v); }
+ realvec fmod(realvec y) const { return vml_std::fmod(v, y.v); }
realvec frexp(intvec_t* irp) const
{
int iri;
- realvec r = std::frexp(v, &iri);
+ realvec r = vml_std::frexp(v, &iri);
int_t ir = iri;
if (isinf()) ir = std::numeric_limits<int_t>::max();
if (isnan()) ir = std::numeric_limits<int_t>::min();
@@ -443,12 +443,12 @@ namespace vecmathlib {
realvec hypot(realvec y) const { return MF::vml_hypot(*this, y); }
intvec_t ilogb() const
{
- int_t r = std::ilogb(v);
+ int_t r = vml_std::ilogb(v);
typedef std::numeric_limits<int_t> NL;
if (FP_ILOGB0 != NL::min() and *this == RV(R(0.0))) {
r = NL::min();
#if defined VML_HAVE_INF
- } else if (INT_MAX != NL::max() and std::isinf(v)) {
+ } else if (INT_MAX != NL::max() and vml_std::isinf(v)) {
r = NL::max();
#endif
#if defined VML_HAVE_NAN
@@ -458,8 +458,8 @@ namespace vecmathlib {
}
return r;
}
- boolvec_t isfinite() const { return std::isfinite(v); }
- boolvec_t isinf() const { return std::isinf(v); }
+ boolvec_t isfinite() const { return vml_std::isfinite(v); }
+ boolvec_t isinf() const { return vml_std::isinf(v); }
boolvec_t isnan() const
{
#if defined VML_HAVE_NAN
@@ -470,14 +470,14 @@ namespace vecmathlib {
// __asm__("ucomiss %[v],%[v]; setp %[r]": [r]"=q"(r): [v]"x"(v));
// return boolvec_t::scalar_t(r);
// This works as well:
- return std::isnan(v);
+ return vml_std::isnan(v);
#else
return BV(false);
#endif
}
- boolvec_t isnormal() const { return std::isnormal(v); }
- realvec ldexp(int_t n) const { return std::ldexp(v, n); }
- realvec ldexp(intvec_t n) const { return std::ldexp(v, n); }
+ boolvec_t isnormal() const { return vml_std::isnormal(v); }
+ realvec ldexp(int_t n) const { return vml_std::ldexp(v, n); }
+ realvec ldexp(intvec_t n) const { return vml_std::ldexp(v, n); }
realvec log() const { return MF::vml_log(*this); }
realvec log10() const { return MF::vml_log10(*this); }
realvec log1p() const { return MF::vml_log1p(*this); }
@@ -485,7 +485,7 @@ namespace vecmathlib {
realvec nextafter(realvec y) const { return MF::vml_nextafter(*this, y); }
realvec pow(realvec y) const { return MF::vml_pow(*this, y); }
realvec rcp() const { return R(1.0)/v; }
- realvec remainder(realvec y) const { return std::remainder(v, y.v); }
+ realvec remainder(realvec y) const { return vml_std::remainder(v, y.v); }
realvec rint() const
{
#ifdef __SSE4_1__
@@ -497,7 +497,7 @@ namespace vecmathlib {
}
realvec round() const { return MF::vml_round(*this); }
realvec rsqrt() const { return MF::vml_rsqrt(*this); }
- boolvec_t signbit() const { return std::signbit(v); }
+ boolvec_t signbit() const { return vml_std::signbit(v); }
realvec sin() const { return MF::vml_sin(*this); }
realvec sinh() const { return MF::vml_sinh(*this); }
realvec sqrt() const { return to_float(_mm_sqrt_ss(from_float(v))); }
diff --git a/vec_sse_float4.h b/vec_sse_float4.h
index c8aa593..ee4bde8 100644
--- a/vec_sse_float4.h
+++ b/vec_sse_float4.h
@@ -487,21 +487,21 @@ namespace vecmathlib {
real_t maxval() const
{
- // return std::fmax(std::fmax((*this)[0], (*this)[1]),
- // std::fmax((*this)[2], (*this)[3]));
+ // return vml_std::fmax(vml_std::fmax((*this)[0], (*this)[1]),
+ // vml_std::fmax((*this)[2], (*this)[3]));
realvec_t x0123 = *this;
realvec_t x1032 = _mm_shuffle_ps(x0123, x0123, 0b10110001);
realvec_t y0022 = x0123.fmax(x1032);
- return std::fmax(y0022[0], y0022[2]);
+ return vml_std::fmax(y0022[0], y0022[2]);
}
real_t minval() const
{
- // return std::fmin(std::fmin((*this)[0], (*this)[1]),
- // std::fmin((*this)[2], (*this)[3]));
+ // return vml_std::fmin(vml_std::fmin((*this)[0], (*this)[1]),
+ // vml_std::fmin((*this)[2], (*this)[3]));
realvec_t x0123 = *this;
realvec_t x1032 = _mm_shuffle_ps(x0123, x0123, 0b10110001);
realvec_t y0022 = x0123.fmin(x1032);
- return std::fmin(y0022[0], y0022[2]);
+ return vml_std::fmin(y0022[0], y0022[2]);
}
real_t prod() const
{
diff --git a/vec_test.h b/vec_test.h
index 5b557ae..84b4e0b 100644
--- a/vec_test.h
+++ b/vec_test.h
@@ -617,13 +617,13 @@ namespace vecmathlib {
real_t maxval() const
{
real_t res = v[0];
- for (int d=1; d<size; ++d) res = std::fmax(res, v[d]);
+ for (int d=1; d<size; ++d) res = vml_std::fmax(res, v[d]);
return res;
}
real_t minval() const
{
real_t res = v[0];
- for (int d=1; d<size; ++d) res = std::fmin(res, v[d]);
+ for (int d=1; d<size; ++d) res = vml_std::fmin(res, v[d]);
return res;
}
real_t prod() const
diff --git a/vec_vsx_double2.h b/vec_vsx_double2.h
index 5104293..0908fbb 100644
--- a/vec_vsx_double2.h
+++ b/vec_vsx_double2.h
@@ -543,11 +543,11 @@ namespace vecmathlib {
real_t maxval() const
{
- return std::fmax((*this)[0], (*this)[1]);
+ return vml_std::fmax((*this)[0], (*this)[1]);
}
real_t minval() const
{
- return std::fmin((*this)[0], (*this)[1]);
+ return vml_std::fmin((*this)[0], (*this)[1]);
}
real_t prod() const
{
OpenPOWER on IntegriCloud