Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / multiprecision / test / concepts / sf_concept_check_elliptic.cpp
1 //  Copyright John Maddock 2012.
2 //  Use, modification and distribution are subject to the
3 //  Boost Software License, Version 1.0. (See accompanying file
4 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 //
7 // This tests that cpp_dec_float_50 meets our
8 // conceptual requirements when used with Boost.Math.
9 //
10 #ifdef _MSC_VER
11 #  define _SCL_SECURE_NO_WARNINGS
12 #  pragma warning(disable:4800)
13 #  pragma warning(disable:4512)
14 #  pragma warning(disable:4127)
15 #  pragma warning(disable:4512)
16 #  pragma warning(disable:4503) // decorated name length exceeded, name was truncated
17 #endif
18
19 #include <libs/math/test/compile_test/poison.hpp>
20
21 #if !defined(TEST_MPF_50) && !defined(TEST_BACKEND) && !defined(TEST_MPZ) \
22    && !defined(TEST_CPP_DEC_FLOAT) && !defined(TEST_MPFR_50)\
23    && !defined(TEST_MPFR_6) && !defined(TEST_MPFR_15) && !defined(TEST_MPFR_17) \
24    && !defined(TEST_MPFR_30) && !defined(TEST_CPP_DEC_FLOAT_NO_ET) && !defined(TEST_LOGGED_ADAPTER)\
25    && !defined(TEST_CPP_BIN_FLOAT)
26 #  define TEST_MPF_50
27 #  define TEST_BACKEND
28 #  define TEST_MPZ
29 #  define TEST_MPFR_50
30 #  define TEST_MPFR_6
31 #  define TEST_MPFR_15
32 #  define TEST_MPFR_17
33 #  define TEST_MPFR_30
34 #  define TEST_CPP_DEC_FLOAT
35 #  define TEST_CPP_DEC_FLOAT_NO_ET
36 #  define TEST_LOGGED_ADAPTER
37 #  define TEST_CPP_BIN_FLOAT
38
39 #ifdef _MSC_VER
40 #pragma message("CAUTION!!: No backend type specified so testing everything.... this will take some time!!")
41 #endif
42 #ifdef __GNUC__
43 #pragma warning "CAUTION!!: No backend type specified so testing everything.... this will take some time!!"
44 #endif
45
46 #endif
47
48 #if defined(TEST_MPF_50) || defined(TEST_MPZ)
49 #include <boost/multiprecision/gmp.hpp>
50 #endif
51 #ifdef TEST_BACKEND
52 #include <boost/multiprecision/concepts/mp_number_archetypes.hpp>
53 #endif
54 #if defined(TEST_CPP_DEC_FLOAT) || defined(TEST_CPP_DEC_FLOAT_NO_ET) || defined(TEST_LOGGED_ADAPTER)
55 #include <boost/multiprecision/cpp_dec_float.hpp>
56 #endif
57 #if defined(TEST_CPP_BIN_FLOAT)
58 #include <boost/multiprecision/cpp_bin_float.hpp>
59 #endif
60 #if defined(TEST_MPFR_50) || defined(TEST_MPFR_6) || defined(TEST_MPFR_15) || defined(TEST_MPFR_17) || defined(TEST_MPFR_30)
61 #include <boost/multiprecision/mpfr.hpp>
62 #endif
63 #ifdef TEST_LOGGED_ADAPTER
64 #include <boost/multiprecision/logged_adaptor.hpp>
65 #endif
66
67 #include <boost/math/special_functions.hpp>
68
69 template <class T>
70 void test_extra(T)
71 {
72    T v1, v2, v3;
73    boost::math::ellint_1(v1);
74    boost::math::ellint_1(v1, v2);
75    boost::math::ellint_2(v1);
76    boost::math::ellint_2(v1, v2);
77    boost::math::ellint_3(v1, v2);
78    boost::math::ellint_3(v1, v2, v3);
79    boost::math::ellint_rc(v1, v2);
80    boost::math::ellint_rd(v1, v2, v3);
81    boost::math::ellint_rf(v1, v2, v3);
82    boost::math::ellint_rj(v1, v2, v3, v1);
83    boost::math::jacobi_elliptic(v1, v2, &v1, &v2);
84    boost::math::jacobi_cd(v1, v2);
85    boost::math::jacobi_cn(v1, v2);
86    boost::math::jacobi_cs(v1, v2);
87    boost::math::jacobi_dc(v1, v2);
88    boost::math::jacobi_dn(v1, v2);
89    boost::math::jacobi_ds(v1, v2);
90    boost::math::jacobi_nc(v1, v2);
91    boost::math::jacobi_nd(v1, v2);
92    boost::math::jacobi_ns(v1, v2);
93    boost::math::jacobi_sc(v1, v2);
94    boost::math::jacobi_sd(v1, v2);
95    boost::math::jacobi_sn(v1, v2);
96 }
97
98 void foo()
99 {
100 #ifdef TEST_BACKEND
101    test_extra(boost::multiprecision::concepts::mp_number_float_architype());
102 #endif
103 #ifdef TEST_MPF_50
104    test_extra(boost::multiprecision::mpf_float_50());
105 #endif
106 #ifdef TEST_MPFR_50
107    test_extra(boost::multiprecision::mpfr_float_50());
108 #endif
109 #ifdef TEST_MPFR_6
110    test_extra(boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<6> >());
111 #endif
112 #ifdef TEST_MPFR_15
113    test_extra(boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<15> >());
114 #endif
115 #ifdef TEST_MPFR_17
116    test_extra(boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<17> >());
117 #endif
118 #ifdef TEST_MPFR_30
119    test_extra(boost::multiprecision::number<boost::multiprecision::mpfr_float_backend<30> >());
120 #endif
121 #ifdef TEST_CPP_DEC_FLOAT
122    test_extra(boost::multiprecision::cpp_dec_float_50());
123 #endif
124 #ifdef TEST_CPP_BIN_FLOAT
125    test_extra(boost::multiprecision::cpp_bin_float_50());
126 #endif
127 #ifdef TEST_CPP_DEC_FLOAT_NO_ET
128    test_extra(boost::multiprecision::number<boost::multiprecision::cpp_dec_float<100>, boost::multiprecision::et_off>());
129 #endif
130 #ifdef TEST_LOGGED_ADAPTER
131    typedef boost::multiprecision::number<boost::multiprecision::logged_adaptor<boost::multiprecision::cpp_dec_float<50> > > num_t;
132    test_extra(num_t());
133 #endif
134 }
135
136 int main()
137 {
138    foo();
139 }