28 #ifndef VC_COMMON_MATH_H_
29 #define VC_COMMON_MATH_H_
31 #define Vc_COMMON_MATH_H_INTERNAL 1
33 #include "trigonometric.h"
38 namespace Vc_VERSIONED_NAMESPACE
42 #include "logarithm.h"
43 #include "exponential.h"
47 AVX::Vector<double> x = _x;
48 typedef AVX::Vector<double> V;
50 typedef AVX::Const<double> C;
52 const M overflow = x > Vc::Detail::doubleConstant< 1, 0x0006232bdd7abcd2ull, 9>();
53 const M underflow = x < Vc::Detail::doubleConstant<-1, 0x0006232bdd7abcd2ull, 9>();
55 V px =
floor(C::log2_e() * x + 0.5);
56 __m128i tmp = _mm256_cvttpd_epi32(px.data());
57 const SimdArray<int, V::Size> n =
SSE::int_v{tmp};
58 x -= px * C::ln2_large();
59 x -= px * C::ln2_small();
62 Vc::Detail::doubleConstant<1, 0x000089cdd5e44be8ull, -13>(),
63 Vc::Detail::doubleConstant<1, 0x000f06d10cca2c7eull, -6>(),
64 Vc::Detail::doubleConstant<1, 0x0000000000000000ull, 0>()
67 Vc::Detail::doubleConstant<1, 0x00092eb6bc365fa0ull, -19>(),
68 Vc::Detail::doubleConstant<1, 0x0004ae39b508b6c0ull, -9>(),
69 Vc::Detail::doubleConstant<1, 0x000d17099887e074ull, -3>(),
70 Vc::Detail::doubleConstant<1, 0x0000000000000000ull, 1>()
73 px = x * ((P[0] * x2 + P[1]) * x2 + P[2]);
74 x = px / ((((Q[0] * x2 + Q[1]) * x2 + Q[2]) * x2 + Q[3]) - px);
79 x(overflow) = std::numeric_limits<double>::infinity();
87 SSE::Vector<double> x = _x;
88 typedef SSE::Vector<double> V;
90 typedef SSE::Const<double> C;
92 const M overflow = x > Vc::Detail::doubleConstant< 1, 0x0006232bdd7abcd2ull, 9>();
93 const M underflow = x < Vc::Detail::doubleConstant<-1, 0x0006232bdd7abcd2ull, 9>();
95 V px =
floor(C::log2_e() * x + 0.5);
96 SimdArray<int, V::Size> n;
97 _mm_storel_epi64(reinterpret_cast<__m128i *>(&n), _mm_cvttpd_epi32(px.data()));
98 x -= px * C::ln2_large();
99 x -= px * C::ln2_small();
102 Vc::Detail::doubleConstant<1, 0x000089cdd5e44be8ull, -13>(),
103 Vc::Detail::doubleConstant<1, 0x000f06d10cca2c7eull, -6>(),
104 Vc::Detail::doubleConstant<1, 0x0000000000000000ull, 0>()
107 Vc::Detail::doubleConstant<1, 0x00092eb6bc365fa0ull, -19>(),
108 Vc::Detail::doubleConstant<1, 0x0004ae39b508b6c0ull, -9>(),
109 Vc::Detail::doubleConstant<1, 0x000d17099887e074ull, -3>(),
110 Vc::Detail::doubleConstant<1, 0x0000000000000000ull, 1>()
113 px = x * ((P[0] * x2 + P[1]) * x2 + P[2]);
114 x = px / ((((Q[0] * x2 + Q[1]) * x2 + Q[2]) * x2 + Q[3]) - px);
119 x(overflow) = std::numeric_limits<double>::infinity();
120 x.setZero(underflow);
128 #undef Vc_COMMON_MATH_H_INTERNAL
130 #endif // VC_COMMON_MATH_H_
Vc::Vector< T > exp(const Vc::Vector< T > &v)
SimdArray< T, N, V, M > floor(const SimdArray< T, N, V, M > &x)
Applies the std:: floor function component-wise and concurrently.
Vc::Vector< T > ldexp(Vc::Vector< T > x, Vc::SimdArray< int, size()> e)
Multiply floating-point number by integral power of 2.
Vector< int > int_v
vector of signed integers
Vector< double > double_v
vector of double precision
constexpr VectorSpecialInitializerOne One
The special object Vc::One can be used to construct Vector and Mask objects initialized to one/true...