예제 #1
0
파일: acscd.cpp 프로젝트: pesterie/nt2
NT2_TEST_CASE_TPL ( acscd_signed_int__1_0,  NT2_INTEGRAL_SIGNED_TYPES)
{
  
  using nt2::acscd;
  using nt2::tag::acscd_;
  typedef typename nt2::meta::as_integer<T>::type iT;
  typedef typename nt2::meta::call<acscd_(T)>::type r_t;
  typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
  typedef typename nt2::meta::upgrade<T>::type u_t;
  typedef typename boost::result_of<nt2::meta::floating(T)>::type wished_r_t;


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


  // specific values tests
  NT2_TEST_ULP_EQUAL(acscd(-nt2::Two<T>()), -30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Mone<T>()), -90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::One<T>()), 90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Two<T>()), 30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Zero<T>()), nt2::Nan<r_t>(), 0.5);
} // end of test for signed_int_
예제 #2
0
파일: acscd.cpp 프로젝트: fpelliccioni/nt2
NT2_TEST_CASE_TPL ( acscd_real__1_0,  NT2_REAL_TYPES)
{

  using nt2::acscd;
  using nt2::tag::acscd_;
  typedef typename nt2::meta::as_integer<T>::type iT;
  typedef typename nt2::meta::call<acscd_(T)>::type r_t;
  typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
  typedef typename nt2::meta::upgrade<T>::type u_t;
  typedef typename boost::dispatch::meta::as_floating<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(acscd(-nt2::Two<T>()), -30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Inf<T>()), nt2::Zero<r_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Minf<T>()), nt2::Zero<r_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Mone<T>()), -90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Nan<T>()), nt2::Nan<r_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::One<T>()), 90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Two<T>()), 30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Zero<T>()), nt2::Nan<r_t>(), 0.5);
} // end of test for floating_
예제 #3
0
파일: acscd.cpp 프로젝트: francescog/nt2
NT2_TEST_CASE_TPL ( acscd_real__1_0,  NT2_REAL_TYPES)
{
  using nt2::acscd;
  using nt2::tag::acscd_;
  using nt2::load; 
  using nt2::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<acscd_(vT)>::type r_t;
  typedef typename nt2::meta::call<acscd_(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(acscd(-nt2::Two<vT>())[0], -30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Inf<vT>())[0], nt2::Zero<sr_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Minf<vT>())[0], nt2::Zero<sr_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Mone<vT>())[0], -90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Nan<vT>())[0], nt2::Nan<sr_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::One<vT>())[0], 90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Two<vT>())[0], 30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Zero<vT>())[0], nt2::Nan<sr_t>(), 0.5);
} // end of test for real_
예제 #4
0
파일: acscd.cpp 프로젝트: caocuongngo/nt2
NT2_TEST_CASE_TPL ( acscd_uint_convert__1_0,  NT2_SIMD_UINT_CONVERT_TYPES)
{
  using nt2::acscd;
  using nt2::tag::acscd_;
  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<acscd_(vT)>::type r_t;
  typedef typename nt2::meta::call<acscd_(T)>::type sr_t;
  typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;

  // specific values tests
  NT2_TEST_ULP_EQUAL(acscd(nt2::One<vT>())[0], 90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Two<vT>())[0], 30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Zero<vT>())[0], nt2::Nan<sr_t>(), 0.5);
} // end of test for uint_convert_
예제 #5
0
NT2_TEST_CASE_TPL ( acscd_real,  NT2_REAL_TYPES)
{
  using nt2::acscd;
  using nt2::tag::acscd_;

  typedef typename nt2::meta::call<acscd_(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(acscd(nt2::Inf<T>()), nt2::Zero<r_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Minf<T>()), nt2::Zero<r_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Nan<T>()), nt2::Nan<r_t>(), 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Zero<T>()), nt2::Nan<r_t>(), 0.5);
#endif
  NT2_TEST_ULP_EQUAL(acscd(-nt2::Two<T>()), -30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Mone<T>()), -90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::One<T>()), 90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Two<T>()), 30, 0.5);
}
예제 #6
0
파일: acscd.cpp 프로젝트: francescog/nt2
NT2_TEST_CASE_TPL ( acscd_real__1_0,  NT2_REAL_TYPES)
{
  using nt2::acscd;
  using nt2::tag::acscd_;
  using nt2::load; 
  using nt2::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<acscd_(vT)>::type r_t;
  typedef typename nt2::meta::call<acscd_(T)>::type sr_t;
  typedef typename nt2::meta::scalar_of<r_t>::type ssr_t;
  double ulpd;
  ulpd=0.0;

  // random verifications
  static const nt2::uint32_t NR = NT2_NB_RANDOM_TEST;
  {
    NT2_CREATE_BUF(tab_a0,T, NR, nt2::One<T>(), nt2::Ten<T>());
    double ulp0, ulpd ; ulpd=ulp0=0.0;
    for(uint32_t j = 0; j < NR/cardinal_of<n_t>::value; j++)
      {
        vT a0 = load<vT>(&tab_a0[0],j);
        r_t v = acscd(a0);
        for(int i = 0; i< cardinal_of<n_t>::value; i++)
        {
          int k = i+j*cardinal_of<n_t>::value;
          NT2_TEST_ULP_EQUAL( v[i],ssr_t(nt2::acscd (tab_a0[k])), 7.0);
          ulp0 = nt2::max(ulpd,ulp0);
        }
      }
    std::cout << "max ulp found is: " << ulp0 << std::endl;
  }
} // end of test for real_
예제 #7
0
파일: acscd.cpp 프로젝트: francescog/nt2
  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<acscd_(vT)>::type r_t;
  typedef typename nt2::meta::call<acscd_(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(acscd(nt2::One<vT>())[0], 90, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Two<vT>())[0], 30, 0.5);
  NT2_TEST_ULP_EQUAL(acscd(nt2::Zero<vT>())[0], nt2::Nan<sr_t>(), 0.5);
} // end of test for int_convert_

NT2_TEST_CASE_TPL ( acscd_uint_convert__1_0,  (uint32_t)(uint64_t))
{
  using nt2::acscd;
  using nt2::tag::acscd_;
  using nt2::load; 
  using nt2::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;
예제 #8
0
파일: acscd.cpp 프로젝트: Mathieu-/nt2
#include <nt2/toolbox/trigonometric/include/acscd.hpp> 
#include <nt2/sdk/unit/tests.hpp> 
#include <nt2/sdk/unit/module.hpp>
#include <nt2/include/functions/is_nan.hpp>
#include <nt2/sdk/constant/real.hpp>
#include <nt2/include/functions/ulpdist.hpp>
//////////////////////////////////////////////////////////////////////////////
// Test behavior of arithmetic components using NT2_TEST_CASE
//////////////////////////////////////////////////////////////////////////////
NT2_TEST_CASE_TPL ( acscd, (double) 
		    (float) 
		    )
{
  using nt2::acscd; 
  using nt2::functors::acscd_;
  const int N = 1; 

   NT2_TEST( (boost::is_same < typename nt2::meta::call<acscd_(T)>::type
	      , T
 	     >::value)
 	    );
   typedef typename boost::result_of<nt2::meta::floating(T)>::type r_t; 
   NT2_TEST(  nt2::is_nan(acscd( T(0) )) );
   NT2_TEST_EQUAL(  acscd( T(1) )  , 90 );
   NT2_TEST_EQUAL(  acscd( T(-1) )  , -90 );
   NT2_TEST_EQUAL(  acscd( T(nt2::Inf<T>()) ), 0 );
   NT2_TEST_EQUAL(  acscd( T(nt2::Minf<T>()) ), 0 );
NT2_TEST_LESSER(  nt2::ulpdist(acscd( T(2)), 30), N); 
NT2_TEST_LESSER(  nt2::ulpdist(acscd( T(-2)), -30), N); 
}