static inline A0 reduce(const A0& a0, A0&, A0&, A0& x) { A0 k = round2even(double_constant<A0,0x400a934f0979a372ll>()*a0); x = a0-k*double_constant<A0,0x3fd3440000000000ll>(); x -= k*double_constant<A0,0x3ed3509f79fef312ll>(); return k; }
static inline A0 reduce(const A0& a0, A0&, A0&, A0& x) { A0 k = round2even(Invlog10_2<A0>()*a0); x = fnms(k, Log10_2hi<A0>(), a0); x = fnms(k, Log10_2lo<A0>(), x); return k; }
static inline A0 reduce(const A0& a0, A0&, A0&, A0& x) { A0 k = round2even(Const<A0,0x40549a78>()*a0); x = a0-k*Const<A0,0x3e9a0000>(); x -= k*Const<A0,0x39826a13>(); return k; }
static inline A0 reduce(const A0& a0, A0& hi, A0& lo, A0& x) { A0 k = round2even(Invlog_2<A0>()*a0); hi = a0 - k * Const<A0,0x3fe62e42fee00000ll>(); lo = k * Const<A0,0x3dea39ef35793c76ll>(); x = hi-lo; return k; }
static inline int_type reduce(const A0& x, A0& xr, A0&xc) { A0 xi = round2even(x*Two<A0>()); A0 x2 = x - xi * Half<A0>(); xr = x2*Pi<A0>(); xc = Zero<A0>(); return toint(xi); }
static inline int_type reduce(const A0& x, A0& xr, A0& xc) { A0 xi = round2even(x*single_constant<A0,0x3c360b61>()); // 1.111111111111111e-02f A0 x2 = x - xi * Ninety<A0>();//90.0f xr = x2*single_constant<A0,0x3c8efa35>(); //0.0174532925199432957692f xc = Zero<A0>(); return toint(xi); }
static inline A0 reduce(const A0& a0, A0& hi, A0& lo, A0& x) { A0 k = round2even(Invlog_2<A0>()*a0); hi = a0-k*Const<A0,0x3f318000>(); lo = k*Const<A0,0xb95e8083>(); x = hi-lo; return k; }
static inline A0 finalize(const A0& a0, const A0& , const A0& c , const A0& k, const A0& , const A0& ) { A0 y = fast_ldexp(c, toint(k)); //adjust for 10^n n flint return sel(b_and(is_gtz(a0), is_flint(a0)), round2even(y), y); }
static inline A0 finalize(const A0& a0, const A0& x, const A0& c, const A0 & k, const A0& ,const A0& ) { A0 y = oneminus(((-(x*c)/(Two<A0>()-c))-x)); y = fast_ldexp(y, toint(k)); // adjust for 2^n n flint return sel(b_and(is_gtz(a0), is_flint(a0)), round2even(y), y); }
static inline int_type fdlibm_medium_reduction(const A0& t, A0& xr, A0& xc) { A0 fn = round2even(t*single_constant<A0,0x3f22f984>()); A0 r = t-fn*single_constant<A0,0x3fc90f80>(); A0 w = fn*single_constant<A0,0x37354443>(); /* 1st round good to 40 bit */ A0 t2 = r; w = fn*single_constant<A0,0x37354400>(); r = t2-w; w = fn*single_constant<A0,0x2e85a308>()-((t2-r)-w); t2 = r; /* 2nd round will cover all possible cases */ w = fn*single_constant<A0,0x2e85a300>(); r = t2-w; w = fn*single_constant<A0,0x248d3132>()-((t2-r)-w); xr = r-w; xc = (r-xr)-w; return toint(fn); }
static inline A0 reduce(const A0& a0, const A0&, const A0&, A0& x) { A0 k = round2even(a0); x = (a0 - k)*Log_2<A0>(); return k; }
///////////////////////////////////////////////////////////////////////////// // Implementation when type is arithmetic_ ///////////////////////////////////////////////////////////////////////////// NT2_REGISTER_DISPATCH(tag::lcm_, tag::cpu_, (A0)(X), ((simd_<arithmetic_<A0>,X>)) ((simd_<arithmetic_<A0>,X>)) ); namespace nt2 { namespace ext { template<class X, class Dummy> struct call<tag::lcm_(tag::simd_<tag::arithmetic_, X> , tag::simd_<tag::arithmetic_, X> ), tag::cpu_, Dummy> : callable { template<class Sig> struct result; template<class This,class A0> struct result<This(A0,A0)> : meta::strip<A0>{};// NT2_FUNCTOR_CALL(2) { return nt2::abs(round2even(a0)*rdivide(round2even(a1), gcd(a0,a1))); } }; } } #endif // modified by jt the 05/01/2011