Esempio n. 1
0
NT2_TEST_CASE_TPL ( cnp_real__2_0,  NT2_SIMD_REAL_TYPES)
{
  using nt2::cnp;
  using nt2::tag::cnp_;
  using nt2::load;
  using boost::simd::native;
  using nt2::meta::cardinal_of;
  typedef NT2_SIMD_DEFAULT_EXTENSION  ext_t;
  typedef typename nt2::meta::upgrade<T>::type   u_t;
  typedef native<T,ext_t>                        n_t;
  typedef n_t                                     vT;
  typedef typename nt2::meta::as_integer<T>::type iT;
  typedef native<iT,ext_t>                       ivT;
  typedef typename nt2::meta::call<cnp_(vT,vT)>::type r_t;
  typedef typename nt2::meta::call<cnp_(T,T)>::type sr_t;
  typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
  double ulpd;
  ulpd=0.0;


  // specific values tests
  NT2_TEST_ULP_EQUAL(cnp(nt2::splat<vT>(10),nt2::splat<vT>(1))[0], T(10), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::splat<vT>(10),nt2::splat<vT>(2))[0], T(45), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::splat<vT>(10),nt2::splat<vT>(8))[0], T(45), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::splat<vT>(2),nt2::splat<vT>(1))[0], T(2), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::splat<vT>(2),nt2::splat<vT>(2))[0], T(1), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Inf<vT>(), nt2::Inf<vT>())[0], nt2::Nan<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Nan<vT>(), nt2::Nan<vT>())[0], nt2::Nan<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::One<vT>(), nt2::One<vT>())[0], nt2::One<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Zero<vT>(), nt2::Zero<vT>())[0], nt2::One<T>(), 0);
} // end of test for floating_
Esempio n. 2
0
File: cnp.cpp Progetto: sschaetz/nt2
NT2_TEST_CASE_TPL ( cnp_real__2_0,  NT2_REAL_TYPES)
{

  using nt2::cnp;
  using nt2::tag::cnp_;
  typedef typename nt2::meta::call<cnp_(T,T)>::type r_t;
  typedef typename boost::common_type<T>::type wished_r_t;


  // return type conformity test
  NT2_TEST( (boost::is_same < r_t, wished_r_t >::value) );
  std::cout << std::endl;



  // specific values tests
  NT2_TEST_ULP_EQUAL(cnp(T(10),T(1)), T(10), 0);
  NT2_TEST_ULP_EQUAL(cnp(T(10),T(2)), T(45), 0);
  NT2_TEST_ULP_EQUAL(cnp(T(10),T(8)), T(45), 0);
  NT2_TEST_ULP_EQUAL(cnp(T(2),T(1)), T(2), 0);
  NT2_TEST_ULP_EQUAL(cnp(T(2),T(2)), T(1), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Inf<T>(), nt2::Inf<T>()), nt2::Nan<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Nan<T>(), nt2::Nan<T>()), nt2::Nan<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::One<T>(), nt2::One<T>()), nt2::One<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Zero<T>(), nt2::Zero<T>()), nt2::One<T>(), 0);
} // end of test for floating_
Esempio n. 3
0
NT2_TEST_CASE_TPL ( cnp_signed_int__2_0,  NT2_INTEGRAL_SIGNED_TYPES)
{
  using nt2::cnp;
  using nt2::tag::cnp_;
  typedef typename nt2::meta::call<cnp_(T,T)>::type r_t;
  typedef T wished_r_t;

  // return type conformity test
  NT2_TEST_TYPE_IS(r_t, wished_r_t);

  // specific values tests
  NT2_TEST_ULP_EQUAL(cnp(nt2::One<T>(), nt2::One<T>()), nt2::One<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Zero<T>(), nt2::Zero<T>()), nt2::One<T>(), 0);
}
Esempio n. 4
0
File: cnp.cpp Progetto: sschaetz/nt2
NT2_TEST_CASE_TPL ( cnp_signed_int__2_0,  NT2_INTEGRAL_SIGNED_TYPES)
{

  using nt2::cnp;
  using nt2::tag::cnp_;
  typedef typename nt2::meta::call<cnp_(T,T)>::type r_t;
  typedef typename boost::common_type<T>::type wished_r_t;


  // return type conformity test
  NT2_TEST( (boost::is_same < r_t, wished_r_t >::value) );
  std::cout << std::endl;



  // specific values tests
  NT2_TEST_ULP_EQUAL(cnp(nt2::One<T>(), nt2::One<T>()), nt2::One<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Zero<T>(), nt2::Zero<T>()), nt2::One<T>(), 0);
} // end of test for signed_int_
Esempio n. 5
0
NT2_TEST_CASE_TPL ( cnp_signed_int__2_0,  NT2_SIMD_INTEGRAL_SIGNED_TYPES)
{
  using nt2::cnp;
  using nt2::tag::cnp_;
  using nt2::load;
  using boost::simd::native;
  using nt2::meta::cardinal_of;
  typedef NT2_SIMD_DEFAULT_EXTENSION  ext_t;
  typedef typename nt2::meta::upgrade<T>::type   u_t;
  typedef native<T,ext_t>                        n_t;
  typedef n_t                                     vT;
  typedef typename nt2::meta::as_integer<T>::type iT;
  typedef native<iT,ext_t>                       ivT;
  typedef typename nt2::meta::call<cnp_(vT,vT)>::type r_t;
  typedef typename nt2::meta::call<cnp_(T,T)>::type sr_t;
  typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
  double ulpd;
  ulpd=0.0;


  // specific values tests
  NT2_TEST_ULP_EQUAL(cnp(nt2::One<vT>(), nt2::One<vT>())[0], nt2::One<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Zero<vT>(), nt2::Zero<vT>())[0], nt2::One<T>(), 0);
} // end of test for signed_int_
Esempio n. 6
0
NT2_TEST_CASE_TPL ( cnp_real__2_0,  NT2_REAL_TYPES)
{
  using nt2::cnp;
  using nt2::tag::cnp_;
  typedef typename nt2::meta::call<cnp_(T,T)>::type r_t;
  typedef T wished_r_t;

  // return type conformity test
  NT2_TEST_TYPE_IS(r_t, wished_r_t);

  // specific values tests
#ifndef BOOST_SIMD_NO_INVALIDS
  NT2_TEST_ULP_EQUAL(cnp(nt2::Inf<T>(), nt2::Inf<T>()), nt2::Nan<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Nan<T>(), nt2::Nan<T>()), nt2::Nan<T>(), 0);
#endif
  NT2_TEST_ULP_EQUAL(cnp(T(10),T(1)), T(10), 0);
  NT2_TEST_ULP_EQUAL(cnp(T(10),T(2)), T(45), 0);
  NT2_TEST_ULP_EQUAL(cnp(T(10),T(8)), T(45), 0);
  NT2_TEST_ULP_EQUAL(cnp(T(2),T(1)), T(2), 0);
  NT2_TEST_ULP_EQUAL(cnp(T(2),T(2)), T(1), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::One<T>(), nt2::One<T>()), nt2::One<T>(), 0);
  NT2_TEST_ULP_EQUAL(cnp(nt2::Zero<T>(), nt2::Zero<T>()), nt2::One<T>(), 0);
}