29 #ifndef VC_COMMON_MATH_H_
30 #define VC_COMMON_MATH_H_
32 #define Vc_COMMON_MATH_H_INTERNAL 1
34 #include "trigonometric.h"
39 namespace Vc_VERSIONED_NAMESPACE
43 #include "logarithm.h"
44 #include "exponential.h"
48 AVX::Vector<double> x = _x;
49 typedef AVX::Vector<double> V;
51 typedef AVX::Const<double> C;
53 const M overflow = x > Vc::Detail::doubleConstant< 1, 0x0006232bdd7abcd2ull, 9>();
54 const M underflow = x < Vc::Detail::doubleConstant<-1, 0x0006232bdd7abcd2ull, 9>();
56 V px = floor(C::log2_e() * x + 0.5);
57 __m128i tmp = _mm256_cvttpd_epi32(px.data());
58 const SimdArray<int, V::Size> n =
SSE::int_v{tmp};
59 x -= px * C::ln2_large();
60 x -= px * C::ln2_small();
63 Vc::Detail::doubleConstant<1, 0x000089cdd5e44be8ull, -13>(),
64 Vc::Detail::doubleConstant<1, 0x000f06d10cca2c7eull, -6>(),
65 Vc::Detail::doubleConstant<1, 0x0000000000000000ull, 0>()
68 Vc::Detail::doubleConstant<1, 0x00092eb6bc365fa0ull, -19>(),
69 Vc::Detail::doubleConstant<1, 0x0004ae39b508b6c0ull, -9>(),
70 Vc::Detail::doubleConstant<1, 0x000d17099887e074ull, -3>(),
71 Vc::Detail::doubleConstant<1, 0x0000000000000000ull, 1>()
74 px = x * ((P[0] * x2 + P[1]) * x2 + P[2]);
75 x = px / ((((Q[0] * x2 + Q[1]) * x2 + Q[2]) * x2 + Q[3]) - px);
80 x(overflow) = std::numeric_limits<double>::infinity();
88 SSE::Vector<double> x = _x;
89 typedef SSE::Vector<double> V;
91 typedef SSE::Const<double> C;
93 const M overflow = x > Vc::Detail::doubleConstant< 1, 0x0006232bdd7abcd2ull, 9>();
94 const M underflow = x < Vc::Detail::doubleConstant<-1, 0x0006232bdd7abcd2ull, 9>();
96 V px = floor(C::log2_e() * x + 0.5);
97 SimdArray<int, V::Size> n;
98 _mm_storel_epi64(reinterpret_cast<__m128i *>(&n), _mm_cvttpd_epi32(px.data()));
99 x -= px * C::ln2_large();
100 x -= px * C::ln2_small();
103 Vc::Detail::doubleConstant<1, 0x000089cdd5e44be8ull, -13>(),
104 Vc::Detail::doubleConstant<1, 0x000f06d10cca2c7eull, -6>(),
105 Vc::Detail::doubleConstant<1, 0x0000000000000000ull, 0>()
108 Vc::Detail::doubleConstant<1, 0x00092eb6bc365fa0ull, -19>(),
109 Vc::Detail::doubleConstant<1, 0x0004ae39b508b6c0ull, -9>(),
110 Vc::Detail::doubleConstant<1, 0x000d17099887e074ull, -3>(),
111 Vc::Detail::doubleConstant<1, 0x0000000000000000ull, 1>()
114 px = x * ((P[0] * x2 + P[1]) * x2 + P[2]);
115 x = px / ((((Q[0] * x2 + Q[1]) * x2 + Q[2]) * x2 + Q[3]) - px);
120 x(overflow) = std::numeric_limits<double>::infinity();
121 x.setZero(underflow);
129 #undef Vc_COMMON_MATH_H_INTERNAL
131 #endif // VC_COMMON_MATH_H_
Vc::Vector< T > exp(const Vc::Vector< T > &v)
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...