Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / math / test / test_long_double_support.cpp
1 // Copyright John Maddock 2009
2
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt
6 // or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8 #include <cmath>
9 #include <math.h>
10 #include <limits.h>
11
12 #define BOOST_TEST_MAIN
13 #include <boost/test/unit_test.hpp> // Boost.Test
14 #include <boost/test/results_collector.hpp>
15 #include <boost/test/unit_test.hpp>
16 #include <boost/test/tools/floating_point_comparison.hpp>
17
18 #include <iostream>
19 #include <iomanip>
20    using std::cout;
21    using std::endl;
22    using std::setprecision;
23
24 #include <boost/array.hpp>
25 #include "functor.hpp"
26 #include "handle_test_result.hpp"
27 #include "table_type.hpp"
28
29 #include <boost/math/tools/config.hpp>
30
31 void expected_results()
32 {
33    //
34    // Define the max and mean errors expected for
35    // various compilers and platforms.
36    //
37    const char* largest_type;
38    largest_type = "(long\\s+)?double";
39
40    add_expected_result(
41       ".*",                          // compiler
42       ".*",                          // stdlib
43       ".*",                          // platform
44       largest_type,                  // test type(s)
45       ".*",                          // test data group
46       ".*", 50, 20);                 // test function
47 }
48
49 template <class R, class Proc, class Arg>
50 struct simple_binder
51 {
52    simple_binder(Proc p, Arg a) : m_proc(p), m_arg(a) {}
53    R operator()(R arg) { return m_proc(arg, m_arg); }
54    operator bool() { return m_proc ? true : false; }
55 private:
56    Proc m_proc;
57    Arg m_arg;
58 };
59
60 template <class A, class Proc>
61 void do_test_std_function(const A& data, const char* type_name, const char* function_name, const char* test_name, Proc proc, const char* inv_function_name = 0, Proc inv_proc = 0)
62 {
63    // warning suppression:
64    (void)data;
65    (void)type_name;
66    (void)test_name;
67    typedef typename A::value_type row_type;
68    typedef typename row_type::value_type value_type;
69
70    boost::math::tools::test_result<value_type> result;
71
72    //
73    // test against data:
74    //
75    result = boost::math::tools::test(
76       data,
77       bind_func<value_type>(proc, 0),
78       extract_result<value_type>(1));
79    handle_test_result(result, data[result.worst()], result.worst(), type_name, function_name, test_name);
80    if(inv_proc)
81    {
82       result = boost::math::tools::test(
83          data,
84          bind_func<value_type>(inv_proc, 1),
85          extract_result<value_type>(0));
86       handle_test_result(result, data[result.worst()], result.worst(), type_name, inv_function_name, test_name);
87    }
88 }
89
90 template <class A>
91 void do_test_std_function_2(const A& data, const char* type_name, const char* function_name, const char* test_name, long double(*proc)(long double, long double), const char* inv_function_name = 0, long double(*inv_proc)(long double, long double) = 0)
92 {
93    // warning suppression:
94    (void)data;
95    (void)type_name;
96    (void)test_name;
97    typedef typename A::value_type row_type;
98    typedef typename row_type::value_type value_type;
99
100    boost::math::tools::test_result<value_type> result;
101
102    //
103    // test against data:
104    //
105    result = boost::math::tools::test(
106       data,
107       bind_func<value_type>(proc, 0, 1),
108       extract_result<value_type>(2));
109    handle_test_result(result, data[result.worst()], result.worst(), type_name, function_name, test_name);
110    if(inv_proc)
111    {
112       result = boost::math::tools::test(
113          data,
114          bind_func<value_type>(inv_proc, 2, 1),
115          extract_result<value_type>(0));
116       handle_test_result(result, data[result.worst()], result.worst(), type_name, inv_function_name, test_name);
117    }
118 }
119
120 long double std_inv_pow(long double a, long double b)
121 {
122    return std::pow(a, 1 / b);
123 }
124 long double std_inv_powl(long double a, long double b)
125 {
126    return ::powl(a, 1 / b);
127 }
128
129
130 void test_spots()
131 {
132    // Basic sanity checks.
133    // Test data taken from functions.wolfram.com
134    long double (*unary_proc)(long double);
135    long double (*inv_unary_proc)(long double);
136    long double(*binary_proc)(long double, long double);
137    long double(*inv_binary_proc)(long double, long double);
138    //
139    // COS:
140    //
141    boost::array<boost::array<long double, 2>, 4> cos_test_data = {{
142       {{ 0, 1, }},
143       {{ 0.125L, 0.992197667229329053149096907788250869543327304736601263468910L, }},
144       {{ 1.125L, 0.431176516798666176551969042921689826840697850225767471037314L, }},
145       {{ 1.75L, -0.178246055649492090382676943942631358969920851291548272886063L, }},
146    }};
147    unary_proc = std::cos;
148    inv_unary_proc = std::acos;
149    do_test_std_function(cos_test_data, "long double", "std::cos", "Mathematica data", unary_proc, "std::acos", inv_unary_proc);
150    unary_proc = ::cosl;
151    inv_unary_proc = ::acosl;
152    do_test_std_function(cos_test_data, "long double", "::cosl", "Mathematica data", unary_proc, "::acosl", inv_unary_proc);
153    //
154    // SIN:
155    //
156    boost::array<boost::array<long double, 2>, 6> sin_test_data = {{
157       {{ 0, 0, }},
158       {{ 0.125L, 0.124674733385227689957442708712108467587834905641679257885515L, }},
159       {{ -0.125L, -0.124674733385227689957442708712108467587834905641679257885515L, }},
160       {{ 1.125L, 0.902267594099095162918416128654829100758989018716070814389152L, }},
161 #if LDBL_MAX_EXP > DBL_MAX_EXP
162       {{ 1e-500L, 1e-500L, }},
163       {{ 1e-1500L, 1e-1500L, }},
164 #else
165       {{ 0, 0, }},
166       {{ 0, 0, }},
167 #endif
168    }};
169    unary_proc = std::sin;
170    inv_unary_proc = std::asin;
171    do_test_std_function(sin_test_data, "long double", "std::sin", "Mathematica data", unary_proc, "std::asin", inv_unary_proc);
172    unary_proc = ::sinl;
173    inv_unary_proc = ::asinl;
174    do_test_std_function(sin_test_data, "long double", "::sinl", "Mathematica data", unary_proc, "::asinl", inv_unary_proc);
175    //
176    // TAN:
177    //
178    boost::array<boost::array<long double, 2>, 6> tan_test_data = {{
179       {{ 0, 0, }},
180       {{ 0.125L, 0.125655136575130967792678218629774000758665763892225542668867L, }},
181       {{ -0.125L, -0.125655136575130967792678218629774000758665763892225542668867L, }},
182       {{ 1.125L, 2.09257127637217900442373398123488678225994171614872057291399L, }},
183 #if LDBL_MAX_EXP > DBL_MAX_EXP
184       {{ 1e-500L, 1e-500L, }},
185       {{ 1e-1500L, 1e-1500L, }},
186 #else
187       {{ 0, 0, }},
188       {{ 0, 0, }},
189 #endif
190    }};
191    unary_proc = std::tan;
192    inv_unary_proc = std::atan;
193    do_test_std_function(tan_test_data, "long double", "std::tan", "Mathematica data", unary_proc, "std::atan", inv_unary_proc);
194    unary_proc = ::tanl;
195    inv_unary_proc = ::atanl;
196    do_test_std_function(tan_test_data, "long double", "::tanl", "Mathematica data", unary_proc, "::atanl", inv_unary_proc);
197    //
198    // EXP:
199    //
200    boost::array<boost::array<long double, 2>, 16> exp_test_data = {{
201       {{ 0, 1, }},
202       {{ 0.125L, 1.13314845306682631682900722781179387256550313174518162591282L, }},
203       {{ -0.125L, 0.882496902584595402864892143229050736222004824990650741770309L, }},
204       {{ 1.125L, 3.08021684891803124500466787877703957705899375982613074033239L, }},
205       {{ 4.60517018598809136803598290936872841520220297725754595206666L, 100L, }},
206       {{ 23.0258509299404568401799145468436420760110148862877297603333L, 1e10L, }},
207       {{ 230.258509299404568401799145468436420760110148862877297603333L, 1e100L, }},
208       {{ -230.258509299404568401799145468436420760110148862877297603333L, 1e-100L, }},
209       {{ -23.0258509299404568401799145468436420760110148862877297603333L, 1e-10L, }},
210       {{ -4.60517018598809136803598290936872841520220297725754595206666L, 0.01L, }},
211 #if LDBL_MAX_EXP > DBL_MAX_EXP
212       {{ 1151.5L, 1.23054049904018215810329849694e+500L, }},
213       {{ 2302.5, 9.1842687219959504902800771504e+999L, }},
214       {{ 11351.5, 7.83089362896060182981072520459e+4929L, }},
215       {{ -11351.5, 1.27699346636729947157842192471e-4930L, }},
216       {{ -2302.5, 1.0888183156107362404277325218e-1000L, }},
217       {{ -1151.5, 8.12651026747999724274336150307e-501L, }},
218 #else
219       {{ 0, 1, }},
220       {{ 0, 1, }},
221       {{ 0, 1, }},
222       {{ 0, 1, }},
223       {{ 0, 1, }},
224       {{ 0, 1, }},
225 #endif
226    }};
227    unary_proc = std::exp;
228    inv_unary_proc = std::log;
229    do_test_std_function(exp_test_data, "long double", "std::exp", "Mathematica data", unary_proc, "std::log", inv_unary_proc);
230    unary_proc = ::expl;
231    inv_unary_proc = ::logl;
232    do_test_std_function(exp_test_data, "long double", "::expl", "Mathematica data", unary_proc, "::logl", inv_unary_proc);
233    //
234    // SQRT:
235    //
236    boost::array<boost::array<long double, 2>, 8> sqrt_test_data = {{
237       {{ 1, 1, }},
238       {{ 0.125L, 0.353553390593273762200422181052424519642417968844237018294170L, }},
239       {{ 1.125L, 1.06066017177982128660126654315727355892725390653271105488251L, }},
240       {{ 1e10L, 1e5L, }},
241       {{ 1e100L, 1e50L, }},
242 #if LDBL_MAX_EXP > DBL_MAX_EXP
243       {{ 1e500L, 1e250L, }},
244       {{ 1e1000L, 1e500L, }},
245       {{ 1e4930L, 1e2465L }},
246 #else
247       {{ 1, 1, }},
248       {{ 1, 1, }},
249       {{ 1, 1, }},
250 #endif
251    }};
252    unary_proc = std::sqrt;
253    inv_unary_proc = 0;
254    do_test_std_function(sqrt_test_data, "long double", "std::sqrt", "Mathematica data", unary_proc, "", inv_unary_proc);
255    unary_proc = ::sqrtl;
256    do_test_std_function(sqrt_test_data, "long double", "::sqrtl", "Mathematica data", unary_proc, "", inv_unary_proc);
257    //
258    // POW:
259    //
260    boost::array<boost::array<long double, 3>, 40> pow_test_data = { {
261       {{ 0.66666666666666666666666666666666667L, 10.5L, 0.014159299884333205600738476477156445L }}, {{ 0.40000000000000000000000000000000000L, 10.5L, 0.000066317769195774370528601435944941645L }}, {{ 0.28571428571428571428571428571428571L, 10.5L, 1.9376955162420093656912416026996235e-6L }}, {{ 0.22222222222222222222222222222222222L, 10.5L, 1.3844223610486906136767179806965939e-7L }}, {{ 0.18181818181818181818181818181818182L, 10.5L, 1.6834172004858801495594195366987548e-8L }}, {{ 0.15384615384615384615384615384615385L, 10.5L, 2.9134646649328940997378075111892189e-9L }}, {{ 0.13333333333333333333333333333333333L, 10.5L, 6.4842049648996264411393424327833257e-10L }}, {{ 0.11764705882352941176470588235294118L, 10.5L, 1.7422131202561313794251961087695707e-10L }}, {{ 0.10526315789473684210526315789473684L, 10.5L, 5.4187878014379968862785381990028068e-11L }}, {{ 0.095238095238095238095238095238095238L, 10.5L, 1.8945774321493250860060262734435905e-11L }}, {{ 0.086956521739130434782608695652173913L, 10.5L, 7.2890793204362496660639940633060965e-12L }}, {{ 0.080000000000000000000000000000000000L, 10.5L, 3.0370004999760496924513885300263083e-12L }}, {{ 0.074074074074074074074074074074074074L, 10.5L, 1.3536158492499429228631254734846878e-12L }}, {{ 0.068965517241379310344827586206896552L, 10.5L, 6.3919883760311690617057708564070401e-13L }}, {{ 0.064516129032258064516129032258064516L, 10.5L, 3.1733441149827305559623332316304054e-13L }}, {{ 0.060606060606060606060606060606060606L, 10.5L, 1.6459573809191842515197160159747426e-13L }}, {{ 0.057142857142857142857142857142857143L, 10.5L, 8.8736130949400182344750668262188042e-14L }}, {{ 0.054054054054054054054054054054054054L, 10.5L, 4.9510447505703867036532738058014010e-14L }}, {{ 0.051282051282051282051282051282051282L, 10.5L, 2.8486335222839832002073312496999392e-14L }}, {{ 0.048780487804878048780487804878048780L, 10.5L, 1.6849400716758403447644197639952420e-14L }},
262       {{ 1.5000000000000000000000000000000000L, 10.5L, 70.624960850392521250220423499662198L }}, {{ 2.5000000000000000000000000000000000L, 10.5L, 15078.914929239174518579929086841195L }}, {{ 3.5000000000000000000000000000000000L, 10.5L, 516076.95410237226543172579761452715L }}, {{ 4.5000000000000000000000000000000000L, 10.5L, 7.2232291830544165404082939248515132e6L }}, {{ 5.5000000000000000000000000000000000L, 10.5L, 5.9402981014532387277725120300837238e7L }}, {{ 6.5000000000000000000000000000000000L, 10.5L, 3.4323395510377093368928553895198363e8L }}, {{ 7.5000000000000000000000000000000000L, 10.5L, 1.5422091149388577381859115936567576e9L }}, {{ 8.5000000000000000000000000000000000L, 10.5L, 5.7398259051853831024096483301864439e9L }}, {{ 9.5000000000000000000000000000000000L, 10.5L, 1.8454311861679240697429074147628415e10L }}, {{ 10.500000000000000000000000000000000L, 10.5L, 5.2782218505872232242456985697751839e10L }}, {{ 11.500000000000000000000000000000000L, 10.5L, 1.3719153764678064136017469971586606e11L }}, {{ 12.500000000000000000000000000000000L, 10.5L, 3.2927225399135962333569506281281311e11L }}, {{ 13.500000000000000000000000000000000L, 10.5L, 7.3876203544315301346698877141070794e11L }}, {{ 14.500000000000000000000000000000000L, 10.5L, 1.5644584144580486482323422555543492e12L }}, {{ 15.500000000000000000000000000000000L, 10.5L, 3.1512497975828317415327223169183800e12L }}, {{ 16.500000000000000000000000000000000L, 10.5L, 6.0754914531356236794145301221027031e12L }}, {{ 17.500000000000000000000000000000000L, 10.5L, 1.1269366708925227994916228749680770e13L }}, {{ 18.500000000000000000000000000000000L, 10.5L, 2.0197757248806823614685377151546893e13L }}, {{ 19.500000000000000000000000000000000L, 10.5L, 3.5104550732037231618759085175272827e13L }}, {{ 20.500000000000000000000000000000000L, 10.5L, 5.9349291812224551314681152356459565e13L }},
263    } };
264    binary_proc = std::pow;
265    inv_binary_proc = std_inv_pow;
266    do_test_std_function_2(pow_test_data, "long double", "std::pow", "Mathematica data", binary_proc, "std::pow", inv_binary_proc);
267    binary_proc = ::powl;
268    inv_binary_proc = std_inv_powl;
269    do_test_std_function_2(pow_test_data, "long double", "::powl", "Mathematica data", binary_proc, "::pow", inv_binary_proc);
270    //
271    // LDEXP:
272    //
273    boost::array<boost::array<long double, 2>, 20> ld_data = { {
274       {{ 0.66666666666666666666666666666666667L, 8.4510040015215293433113547025066667e29L }}, {{ 0.40000000000000000000000000000000000L, 5.0706024009129176059868128215040000e29L }}, {{ 0.28571428571428571428571428571428571L, 3.6218588577949411471334377296457143e29L }}, {{ 0.22222222222222222222222222222222222L, 2.8170013338405097811037849008355556e29L }}, {{ 0.18181818181818181818181818181818182L, 2.3048192731422352754485512825018182e29L }}, {{ 0.15384615384615384615384615384615385L, 1.9502316926588144638410818544246154e29L }}, {{ 0.13333333333333333333333333333333333L, 1.6902008003043058686622709405013333e29L }}, {{ 0.11764705882352941176470588235294118L, 1.4913536473273287076431802416188235e29L }}, {{ 0.10526315789473684210526315789473684L, 1.3343690528718204226281086372378947e29L }}, {{ 0.095238095238095238095238095238095238L, 1.2072862859316470490444792432152381e29L }}, {{ 0.086956521739130434782608695652173913L, 1.1023048697636777404319158307617391e29L }}, {{ 0.080000000000000000000000000000000000L, 1.0141204801825835211973625643008000e29L }}, {{ 0.074074074074074074074074074074074074L, 9.3900044461350326036792830027851852e28L }}, {{ 0.068965517241379310344827586206896552L, 8.7424179326084786310117462439724138e28L }}, {{ 0.064516129032258064516129032258064516L, 8.1783909692143832354626013250064516e28L }}, {{ 0.060606060606060606060606060606060606L, 7.6827309104741175848285042750060606e28L }}, {{ 0.057142857142857142857142857142857143L, 7.2437177155898822942668754592914286e28L }}, {{ 0.054054054054054054054054054054054054L, 6.8521654066390778459281254344648649e28L }}, {{ 0.051282051282051282051282051282051282L, 6.5007723088627148794702728480820513e28L }}, {{ 0.048780487804878048780487804878048780L, 6.1836614645279482999839180750048780e28L }}
275    }};
276    using namespace boost;
277    long double(*pld)(long double, int) = std::ldexp;
278    do_test_std_function(ld_data, "long double", "std::ldexp", "Mathematica data", simple_binder<long double, long double(*)(long double, int), int>(pld, 100), "std::ldexp", simple_binder<long double, long double(*)(long double, int), int>(pld, -100));
279    pld = ::ldexpl;
280    do_test_std_function(ld_data, "long double", "::ldexp", "Mathematica data", simple_binder<long double, long double(*)(long double, int), int>(pld, 100), "::ldexp", simple_binder<long double, long double(*)(long double, int), int>(pld, -100));
281    //
282    // Sinh:
283    //
284    boost::array<boost::array<long double, 2>, 20> sinh_data = { {
285       {{ 1.0L, 1.1752011936438014568823818505956008L }}, {{ 2.0L, 3.6268604078470187676682139828012617L }}, {{ 3.0L, 10.017874927409901898974593619465828L }}, {{ 4.0L, 27.289917197127752448908271590793819L }}, {{ 5.0L, 74.203210577788758977009471996064566L }}, {{ 6.0L, 201.71315737027922812498206768797873L }}, {{ 7.0L, 548.31612327324652237375611757601851L }}, {{ 8.0L, 1490.4788257895501861158766390318814L }}, {{ 9.0L, 4051.5419020827899605152235958980346L }}, {{ 10.L, 11013.232874703393377236524554846364L }}, {{ 11.L, 29937.070849248058832540413239811132L }}, {{ 12.L, 81377.395706429854227338497569902237L }}, {{ 13.L, 221206.69600333008695956086081165150L }}, {{ 14.L, 601302.14208197262451506660144189773L }}, {{ 15.L, 1.6345086862359023684906766101516749e6L }}, {{ 16.L, 4.4430552602538800507941522408334683e6L }}, {{ 17.L, 1.2077476376787628407699123664359614e7L }}, {{ 18.L, 3.2829984568665247954403379273215799e7L }}, {{ 19.L, 8.9241150481593627621056798125727582e7L }}, {{ 20.L, 2.4258259770489513795397660405149137e8L }},
286    } };
287    unary_proc = &std::sinh;
288 #if __cplusplus >= 201103
289    inv_unary_proc = &std::asinh;
290 #else
291    inv_unary_proc = 0;
292 #endif
293    do_test_std_function(sinh_data, "long double", "std::sinh", "Mathematica data", unary_proc, "std::asinh", inv_unary_proc);
294    unary_proc = ::sinhl;
295 #if __cplusplus >= 201103
296    inv_unary_proc = ::asinhl;
297 #endif
298    do_test_std_function(sinh_data, "long double", "::sinhl", "Mathematica data", unary_proc, "::asinhl", inv_unary_proc);
299    //
300    // Cosh:
301    //
302    boost::array<boost::array<long double, 2L>, 20L> cosh_data = { {
303       {{ 1.0L, 1.5430806348152437784779056207570617L }}, {{ 2.0L, 3.7621956910836314595622134777737461L }}, {{ 3.0L, 10.067661995777765841953936035115890L }}, {{ 4.0L, 27.308232836016486629201989612067060L }}, {{ 5.0L, 74.209948524787844444106108044487714L }}, {{ 6.0L, 201.71563612245589448340511285540955L }}, {{ 7.0L, 548.31703515521207688996412071210292L }}, {{ 8.0L, 1490.4791612521780886277154604210072L }}, {{ 9.0L, 4051.5420254925940471947730935347253L }}, {{ 10.L, 11013.232920103323139721376090437880L }}, {{ 11.L, 29937.070865949759622786072552446649L }}, {{ 12.L, 81377.395712574066580666707328584546L }}, {{ 13.L, 221206.69600559041636654191513743678L }}, {{ 14.L, 601302.14208280415323417016932596172L }}, {{ 15.L, 1.6345086862362082708111784359400464e6L }}, {{ 16.L, 4.4430552602539925859688714999479821e6L }}, {{ 17.L, 1.2077476376787669807076311516026210e7L }}, {{ 18.L, 3.2829984568665263184383123985844235e7L }}, {{ 19.L, 8.9241150481593633223853235662995122e7L }}, {{ 20.L, 2.4258259770489514001513022649004919e8L }},
304    } };
305    unary_proc = &std::cosh;
306 #if __cplusplus >= 201103
307    inv_unary_proc = &std::acosh;
308 #endif
309    do_test_std_function(cosh_data, "long double", "std::cosh", "Mathematica data", unary_proc, "std::acosh", inv_unary_proc);
310    unary_proc = ::coshl;
311 #if __cplusplus >= 201103
312    inv_unary_proc = ::acoshl;
313 #endif
314    do_test_std_function(cosh_data, "long double", "::cosh", "Mathematica data", unary_proc, "::acosh", inv_unary_proc);
315    //
316    // Tanh:
317    //
318    boost::array<boost::array<long double, 2L>, 20L> tanh_data = { {
319       {{ 2.0000000000000000000000000000000000L, 0.96402758007581688394641372410092315L }}, {{ 1.0000000000000000000000000000000000L, 0.76159415595576488811945828260479359L }}, {{ 0.66666666666666666666666666666666667L, 0.58278294534791012006763998724863620L }}, {{ 0.50000000000000000000000000000000000L, 0.46211715726000975850231848364367255L }}, {{ 0.40000000000000000000000000000000000L, 0.37994896225522488526774812389687331L }}, {{ 0.33333333333333333333333333333333333L, 0.32151273753163434471940622242520647L }}, {{ 0.28571428571428571428571428571428571L, 0.27818549032570244047180008724146611L }}, {{ 0.25000000000000000000000000000000000L, 0.24491866240370912927780113149101696L }}, {{ 0.22222222222222222222222222222222222L, 0.21863508368712133408473136585229335L }}, {{ 0.20000000000000000000000000000000000L, 0.19737532022490400073815731881101567L }}, {{ 0.18181818181818181818181818181818182L, 0.17984081852510791219962261245781186L }}, {{ 0.16666666666666666666666666666666667L, 0.16514041292462935373278922792245912L }}, {{ 0.15384615384615384615384615384615385L, 0.15264375981490485028417961210708858L }}, {{ 0.14285714285714285714285714285714286L, 0.14189319376693254602300070386766884L }}, {{ 0.13333333333333333333333333333333333L, 0.13254878839087838732054090217452509L }}, {{ 0.12500000000000000000000000000000000L, 0.12435300177159620805464727580589271L }}, {{ 0.11764705882352941176470588235294118L, 0.11710726941545656349019174731833940L }}, {{ 0.11111111111111111111111111111111111L, 0.11065611052473799138171921474515056L }}, {{ 0.10526315789473684210526315789473684L, 0.10487608974842188468874887218357955L }}, {{ 0.10000000000000000000000000000000000L, 0.099667994624955817118305083678352184L }}
320    } };
321    unary_proc = &std::tanh;
322 #if __cplusplus >= 201103
323    inv_unary_proc = &std::atanh;
324 #endif
325    do_test_std_function(tanh_data, "long double", "std::tanh", "Mathematica data", unary_proc, "std::atanh", inv_unary_proc);
326    unary_proc = ::tanhl;
327 #if __cplusplus >= 201103
328    inv_unary_proc = ::atanhl;
329 #endif
330    do_test_std_function(tanh_data, "long double", "::tanh", "Mathematica data", unary_proc, "::atanh", inv_unary_proc);
331    //
332    // ABS, FABS:
333    //
334    boost::array<boost::array<long double, 2L>, 20L> abs_data = { {
335       {{ -2.0000000000000000000000000000000000L, 2.0000000000000000000000000000000000L }}, {{ -1.0000000000000000000000000000000000L, 1.0000000000000000000000000000000000L }}, {{ -0.66666666666666666666666666666666667L, 0.66666666666666666666666666666666667L }}, {{ -0.50000000000000000000000000000000000L, 0.50000000000000000000000000000000000L }}, {{ -0.40000000000000000000000000000000000L, 0.40000000000000000000000000000000000L }}, {{ -0.33333333333333333333333333333333333L, 0.33333333333333333333333333333333333L }}, {{ -0.28571428571428571428571428571428571L, 0.28571428571428571428571428571428571L }}, {{ -0.25000000000000000000000000000000000L, 0.25000000000000000000000000000000000L }}, {{ -0.22222222222222222222222222222222222L, 0.22222222222222222222222222222222222L }}, {{ -0.20000000000000000000000000000000000L, 0.20000000000000000000000000000000000L }}, {{ -0.18181818181818181818181818181818182L, 0.18181818181818181818181818181818182L }}, {{ -0.16666666666666666666666666666666667L, 0.16666666666666666666666666666666667L }}, {{ -0.15384615384615384615384615384615385L, 0.15384615384615384615384615384615385L }}, {{ -0.14285714285714285714285714285714286L, 0.14285714285714285714285714285714286L }}, {{ -0.13333333333333333333333333333333333L, 0.13333333333333333333333333333333333L }}, {{ -0.12500000000000000000000000000000000L, 0.12500000000000000000000000000000000L }}, {{ -0.11764705882352941176470588235294118L, 0.11764705882352941176470588235294118L }}, {{ -0.11111111111111111111111111111111111L, 0.11111111111111111111111111111111111L }}, {{ -0.10526315789473684210526315789473684L, 0.10526315789473684210526315789473684L }}, {{ -0.10000000000000000000000000000000000L, 0.10000000000000000000000000000000000L }}
336    } };
337    unary_proc = &std::abs;
338    inv_unary_proc = 0;
339    do_test_std_function(abs_data, "long double", "std::abs", "Mathematica data", unary_proc, "std::abs", inv_unary_proc);
340    unary_proc = &std::fabs;
341    inv_unary_proc = 0;
342    do_test_std_function(abs_data, "long double", "std::fabs", "Mathematica data", unary_proc, "std::abs", inv_unary_proc);
343    unary_proc = ::fabsl;
344    do_test_std_function(abs_data, "long double", "::fabs", "Mathematica data", unary_proc, "::abs", inv_unary_proc);
345 }
346
347
348 BOOST_AUTO_TEST_CASE( test_main )
349 {
350    expected_results();
351    std::cout << "Running tests with BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS "
352 #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
353       "defined."
354 #else
355       "not defined."
356 #endif
357       << std::endl;
358    // Basic sanity-check spot values.
359    // (Parameter value, arbitrarily zero, only communicates the floating point type).
360    test_spots(); // Test long double.
361
362
363 } // BOOST_AUTO_TEST_CASE( test_main )
364