diff --git a/include/boost/math/concepts/real_concept.hpp b/include/boost/math/concepts/real_concept.hpp index d27234145..ca887e9f4 100644 --- a/include/boost/math/concepts/real_concept.hpp +++ b/include/boost/math/concepts/real_concept.hpp @@ -77,9 +77,9 @@ public: { m_value *= other.value(); return *this; } real_concept& operator/=(const real_concept& other) { m_value /= other.value(); return *this; } - real_concept operator-() + real_concept operator-()const { return -m_value; } - real_concept& operator+() + real_concept const& operator+()const { return *this; } private: diff --git a/include/boost/math/special_functions/expm1.hpp b/include/boost/math/special_functions/expm1.hpp index 6d3af2cad..9fe35309c 100644 --- a/include/boost/math/special_functions/expm1.hpp +++ b/include/boost/math/special_functions/expm1.hpp @@ -10,6 +10,7 @@ #include // platform's ::expm1 #include #include +#include #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # include @@ -17,10 +18,6 @@ # include #endif -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std{ using ::exp; using ::fabs; } -#endif - namespace boost{ namespace math{ namespace detail diff --git a/include/boost/math/special_functions/igamma_inverse.hpp b/include/boost/math/special_functions/igamma_inverse.hpp index 1dfe99ee9..f798d81dc 100644 --- a/include/boost/math/special_functions/igamma_inverse.hpp +++ b/include/boost/math/special_functions/igamma_inverse.hpp @@ -7,6 +7,7 @@ #define BOOST_MATH_SPECIAL_FUNCTIONS_IGAMMA_INVERSE_HPP #include +#include #include #include @@ -310,7 +311,7 @@ struct gamma_P_inverse_func if((fabs(div) > 1) && (tools::max_value() / fabs(div) < f2)) { // overflow: - f2 = tools::max_value() / 2; + f2 = -tools::max_value() / 2; } else { diff --git a/include/boost/math/special_functions/log1p.hpp b/include/boost/math/special_functions/log1p.hpp index 20d40e653..41284e348 100644 --- a/include/boost/math/special_functions/log1p.hpp +++ b/include/boost/math/special_functions/log1p.hpp @@ -18,10 +18,6 @@ # include #endif -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std{ using ::fabs; using ::log; } -#endif - namespace boost{ namespace math{ namespace detail @@ -79,7 +75,7 @@ T log1p(T x) return log(1 + x); // Note that without numeric_limits specialisation support, // epsilon just returns zero, and our "optimisation" will always fail: - if(a < std::numeric_limits::epsilon()) + if(a < tools::epsilon()) return x; detail::log1p_series s(x); return tools::sum_series(s, tools::digits() + 2); diff --git a/include/boost/math/special_functions/sign.hpp b/include/boost/math/special_functions/sign.hpp new file mode 100644 index 000000000..103862a7a --- /dev/null +++ b/include/boost/math/special_functions/sign.hpp @@ -0,0 +1,34 @@ +// (C) Copyright John Maddock 2006. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_MATH_TOOLS_SIGN_HPP +#define BOOST_MATH_TOOLS_SIGN_HPP + +namespace boost{ namespace math{ + +template +inline int sign(const T& z) +{ + return (z == 0) ? 0 : (z < 0) ? -1 : 1; +} + +template +inline int signbit(const T& z) +{ + return (z < 0) ? 1 : 0; +} + +template +inline T copysign(const T& x, const T& y) +{ + return fabs(x) * boost::math::sign(y); +} + +} // namespace math +} // namespace boost + + +#endif // BOOST_MATH_TOOLS_SIGN_HPP + diff --git a/include/boost/math/tools/evaluation_type.hpp b/include/boost/math/tools/evaluation_type.hpp index 0f4c9eccc..da7312eff 100644 --- a/include/boost/math/tools/evaluation_type.hpp +++ b/include/boost/math/tools/evaluation_type.hpp @@ -41,7 +41,7 @@ struct evaluation // as numeric_limits would give us no clue that we were // about to go out of range for a double. // -#if !defined(__CYGWIN__) +#if !defined(__CYGWIN__) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) template<> struct evaluation { diff --git a/include/boost/math/tools/ntl.hpp b/include/boost/math/tools/ntl.hpp index 61fa0452a..6c935d301 100644 --- a/include/boost/math/tools/ntl.hpp +++ b/include/boost/math/tools/ntl.hpp @@ -163,7 +163,7 @@ NTL::RR epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL::RR)) return ldexp(NTL::RR(1), 1-digits()); } -void setprecision(std::ostream& os, NTL::RR, int p) +void setprecision(std::ostream& /*os*/, NTL::RR, int p) { NTL::RR::SetOutputPrecision(p); } @@ -259,7 +259,7 @@ NTL::quad_float epsilon(BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(NTL:: return val; } -void setprecision(std::ostream& os, NTL::quad_float, int p) +void setprecision(std::ostream& /*os*/, NTL::quad_float, int p) { NTL::quad_float::SetOutputPrecision(p); } diff --git a/include/boost/math/tools/test.hpp b/include/boost/math/tools/test.hpp index 257946132..f242149fd 100644 --- a/include/boost/math/tools/test.hpp +++ b/include/boost/math/tools/test.hpp @@ -8,6 +8,7 @@ #include #include +#include #if defined(__CYGWIN__) #define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS @@ -18,8 +19,23 @@ namespace boost{ namespace math{ namespace tools{ template struct test_result { +private: boost::math::tools::stats stat; // Statistics for the test. unsigned worst_case; // Index of the worst case test. +public: + test_result() { worst_case = 0; } + void set_worst(int i){ worst_case = i; } + void add(const T& point){ stat.add(point); } + // accessors: + unsigned worst()const{ return worst_case; } + T min BOOST_PREVENT_MACRO_SUBSTITUTION()const{ return (stat.min)(); } + T max BOOST_PREVENT_MACRO_SUBSTITUTION()const{ return (stat.max)(); } + T total()const{ return stat.total(); } + T mean()const{ return stat.mean(); } + boost::uintmax_t count()const{ return stat.count(); } + T variance()const{ return stat.variance(); } + T variance1()const{ return stat.variance1(); } + T rms()const{ return stat.rms(); } test_result& operator+=(const test_result& t) { @@ -114,7 +130,6 @@ test_result::value_type> test(const A& a, F1 t typedef typename row_type::value_type value_type; test_result result; - result.worst_case = 0; for(unsigned i = 0; i < a.size(); ++i) { @@ -138,16 +153,18 @@ test_result::value_type> test(const A& a, F1 t std::cout << "CAUTION: Found non-finite result, when a finite value was expected at entry " << i << "\n"; std::cout << "Found: " << point << " Expected " << expected << " Error: " << err << std::endl; print_row(row); + BOOST_ERROR("Unexpected non-finite result"); } if(err > 0.5) { std::cout << "CAUTION: Gross error found at entry " << i << ".\n"; std::cout << "Found: " << point << " Expected " << expected << " Error: " << err << std::endl; print_row(row); + BOOST_ERROR("Gross error"); } - result.stat.add(err); - if((result.stat.max)() == err) - result.worst_case = i; + result.add(err); + if((result.max)() == err) + result.set_worst(i); } return result; } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 6aeb28a2a..ea273b84b 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -2,10 +2,13 @@ # bring in the rules for testing import testing ; -project +project : requirements gcc:-Wno-missing-braces ../../.. + /boost/regex//boost_regex + shared:BOOST_REGEX_DYN_LINK=1 + BOOST_ALL_NO_LIB=1 ; run log1p_expm1_test.cpp ; @@ -21,6 +24,9 @@ run test_factorials.cpp ; run test_fisher.cpp ; run test_gamma.cpp ; run test_ibeta.cpp ; +run test_ibeta_inv.cpp ; +run test_igamma.cpp ; +run test_igamma_inv.cpp ; # run test_minima.cpp ; run test_negative_binomial.cpp ; run test_promotion.cpp ; @@ -37,3 +43,8 @@ run test_tgamma_ratio.cpp ; + + + + + diff --git a/test/handle_test_result.hpp b/test/handle_test_result.hpp new file mode 100644 index 000000000..654988bb2 --- /dev/null +++ b/test/handle_test_result.hpp @@ -0,0 +1,186 @@ + + +#ifndef BOOST_MATH_HANDLE_TEST_RESULT +#define BOOST_MATH_HANDLE_TEST_RESULT + +#include +#include +#include +#include +#include + +// +// Every client of this header has to define this function, +// and initialise the table of expected results: +// +void expected_results(); + +typedef std::pair > expected_data_type; +typedef std::list list_type; + +inline list_type& + get_expected_data() +{ + static list_type data; + return data; +} + +inline void add_expected_result( + const char* compiler, + const char* library, + const char* platform, + const char* type_name, + const char* test_name, + const char* group_name, + unsigned max_peek_error, + unsigned max_mean_error) +{ + std::string re("(?:"); + re += compiler; + re += ")"; + re += "\\|"; + re += "(?:"; + re += library; + re += ")"; + re += "\\|"; + re += "(?:"; + re += platform; + re += ")"; + re += "\\|"; + re += "(?:"; + re += type_name; + re += ")"; + re += "\\|"; + re += "(?:"; + re += test_name; + re += ")"; + re += "\\|"; + re += "(?:"; + re += group_name; + re += ")"; + get_expected_data().push_back( + std::make_pair(boost::regex(re), + std::make_pair(max_peek_error, max_mean_error))); +} + +inline std::string build_test_name(const char* type_name, const char* test_name, const char* group_name) +{ + std::string result(BOOST_COMPILER); + result += "|"; + result += BOOST_STDLIB; + result += "|"; + result += BOOST_PLATFORM; + result += "|"; + result += type_name; + result += "|"; + result += group_name; + result += "|"; + result += test_name; + return result; +} + +inline const std::pair& + get_max_errors(const char* type_name, const char* test_name, const char* group_name) +{ + static const std::pair defaults(1, 1); + std::string name = build_test_name(type_name, test_name, group_name); + list_type& l = get_expected_data(); + list_type::const_iterator a(l.begin()), b(l.end()); + while(a != b) + { + if(regex_match(name, a->first)) + { + return a->second; + } + ++a; + } + return defaults; +} + +template +void handle_test_result(const boost::math::tools::test_result& result, + const Seq& worst, int row, + const char* type_name, + const char* test_name, + const char* group_name) +{ + using namespace std; // To aid selection of the right pow. + T eps = boost::math::tools::epsilon(); + std::cout << std::setprecision(4); + + T max_error_found = (result.max)()/eps; + T mean_error_found = result.rms()/eps; + // + // Begin by printing the main tag line with the results: + // + std::cout << test_name << "<" << type_name << "> Max = " << max_error_found + << " RMS Mean=" << mean_error_found; + // + // If the max error is non-zero, give the row of the table that + // produced the worst error: + // + if((result.max)() != 0) + { + std::cout << "\n worst case at row: " + << row << "\n { "; + for(unsigned i = 0; i < worst.size(); ++i) + { + if(i) + std::cout << ", "; + std::cout << worst[i]; + } + std::cout << " }"; + } + std::cout << std::endl; + // + // Now verify that the results are within our expected bounds: + // + std::pair const& bounds = get_max_errors(type_name, test_name, group_name); + if(bounds.first < max_error_found) + { + std::cerr << "Peak error greater than expected value of " << bounds.first << std::endl; + BOOST_CHECK(bounds.first >= max_error_found); + } + if(bounds.second < mean_error_found) + { + std::cerr << "Peak error greater than expected value of " << bounds.second << std::endl; + BOOST_CHECK(bounds.second >= mean_error_found); + } +} + +template +void print_test_result(const boost::math::tools::test_result& result, + const Seq& worst, int row, const char* name, const char* test) +{ + using namespace std; // To aid selection of the right pow. + T eps = boost::math::tools::epsilon(); + std::cout << std::setprecision(4); + + T max_error_found = (result.max)()/eps; + T mean_error_found = result.rms()/eps; + // + // Begin by printing the main tag line with the results: + // + std::cout << test << "(" << name << ") Max = " << max_error_found + << " RMS Mean=" << mean_error_found; + // + // If the max error is non-zero, give the row of the table that + // produced the worst error: + // + if((result.max)() != 0) + { + std::cout << "\n worst case at row: " + << row << "\n { "; + for(unsigned i = 0; i < worst.size(); ++i) + { + if(i) + std::cout << ", "; + std::cout << worst[i]; + } + std::cout << " }"; + } + std::cout << std::endl; +} + +#endif // BOOST_MATH_HANDLE_TEST_RESULT + diff --git a/test/log1p_expm1_data.ipp b/test/log1p_expm1_data.ipp new file mode 100644 index 000000000..9389d4357 --- /dev/null +++ b/test/log1p_expm1_data.ipp @@ -0,0 +1,85 @@ +#define SC_(x) static_cast(BOOST_JOIN(x, L)) + static const boost::array, 80> log1p_expm1_data = { + SC_(-0.69330310821533203125e0), SC_(-0.1181895342296499380302723361817935835636e1), SC_(-0.5000779577496508480606742934033661111325e0), + SC_(-0.650003612041473388671875e0), SC_(-0.1049832444670425873798449427248829256278e1), SC_(-0.477956108886575099597621504254337139212e0), + SC_(-0.5634434223175048828125e0), SC_(-0.8288372954181591063099417140530721209296e0), SC_(-0.4307544676154126107123951950891833745657e0), + SC_(-0.546193540096282958984375e0), SC_(-0.7900844716039173375586798387434829539395e0), SC_(-0.4208498682390169422105137923243733478616e0), + SC_(-0.542549669742584228515625e0), SC_(-0.7820869679038185958797390511513816016257e0), SC_(-0.4187356706519199578716316143188015118402e0), + SC_(-0.5222184658050537109375e0), SC_(-0.7386016923991178813343233368825674656574e0), SC_(-0.4067969136237976293436891521638796489665e0), + SC_(-0.510332167148590087890625e0), SC_(-0.7140280098902130849529032452448458253718e0), SC_(-0.3997038529677125427667940816216463479375e0), + SC_(-0.50135910511016845703125e0), SC_(-0.6958690918220109127943821843553816517932e0), SC_(-0.3942931192785328340465460021958309251731e0), + SC_(-0.479341685771942138671875e0), SC_(-0.6526612791947966365578043302467499708984e0), SC_(-0.3808091201700817035685503987715593769588e0), + SC_(-0.4362652301788330078125e0), SC_(-0.5731714043684679946812364099230074705554e0), SC_(-0.3535537538578334381043477595638178633635e0), + SC_(-0.4033059179782867431640625e0), SC_(-0.5163507223485766856253687547437478575359e0), SC_(-0.3318923180936536087108170796894639170118e0), + SC_(-0.3905523121356964111328125e0), SC_(-0.4952021616945213559322173628246423264147e0), SC_(-0.3233169689815286035820337522007644642142e0), + SC_(-0.3101024627685546875e0), SC_(-0.3712121891835896680955152331639073308925e0), SC_(-0.2666281909314749260551669118328805822824e0), + SC_(-0.2841587960720062255859375e0), SC_(-0.3342969188422780419049667231102322921458e0), SC_(-0.247352882189668478949423010818860745509e0), + SC_(-0.268566131591796875e0), SC_(-0.3127484680657795755742977783527708289938e0), SC_(-0.2355251348015818742687440901815837983695e0), + SC_(-0.19418840110301971435546875e0), SC_(-0.215905312065666655084617543044814851896e0), SC_(-0.1764972591721576227824907304661137322776e0), + SC_(-0.14176605641841888427734375e0), SC_(-0.1528785551425763265780363302506293842933e0), SC_(-0.1321757453457543023426366655287893957346e0), + SC_(-0.109534211456775665283203125e0), SC_(-0.1160105952462048156067755365883457898243e0), SC_(-0.1037484982319069072752933517880363955799e0), + SC_(-0.2047410048544406890869140625e-1), SC_(-0.2068660038044094868521052319477265955827e-1), SC_(-0.2026592921724753704129022027337835687888e-1), + SC_(0.1690093176520690576580818742513656616211e-8), SC_(0.1690093175092483105529122131518271037775e-8), SC_(0.16900931779488980500463190560092746436e-8), + SC_(0.2114990849122477811761200428009033203125e-8), SC_(0.2114990846885884668978873262661703032735e-8), SC_(0.2114990851359070959273901626052243209537e-8), + SC_(0.7099628440698779741069301962852478027344e-8), SC_(0.7099628415496417862364745346932718974223e-8), SC_(0.7099628465901141798701264063185361883662e-8), + SC_(0.136718796284185373224318027496337890625e-7), SC_(0.1367187953495839188729947299064627330362e-7), SC_(0.1367187972187868403533999531964021065056e-7), + SC_(0.1679341288252089725574478507041931152344e-7), SC_(0.1679341274151154071302093036120830402912e-7), SC_(0.1679341302353025616649699444201095417115e-7), + SC_(0.586768322818898013792932033538818359375e-7), SC_(0.5867683056040454540164807679535005383825e-7), SC_(0.5867683400337515836824145241465956859382e-7), + SC_(0.1140460881288163363933563232421875e-6), SC_(0.1140460816255617220976462903776019835232e-6), SC_(0.1140460946320716923598363683695123099251e-6), + SC_(0.1455586016163579188287258148193359375e-6), SC_(0.1455585910227056945720521239406972268757e-6), SC_(0.1455586122100116850826593912609916845078e-6), + SC_(0.38918477685001562349498271942138671875e-6), SC_(0.3891847011176400068545868550436683472421e-6), SC_(0.3891848525824207140259509650302544482884e-6), + SC_(0.623782625552848912775516510009765625e-6), SC_(0.6237824310005478475318960793412787601785e-6), SC_(0.623782820105271336383228077398355607783e-6), + SC_(0.104669607026153244078159332275390625e-5), SC_(0.1046695522475582933881286527214809459507e-5), SC_(0.1046696618048055313232628353357778906342e-5), + SC_(0.2951089072666945867240428924560546875e-5), SC_(0.2951084718212155380639451770777340673208e-5), SC_(0.2951093427134586747271699561094046027716e-5), + SC_(0.4877083483734168112277984619140625e-5), SC_(0.4877071590801182991613986686611799404767e-5), SC_(0.487709537672515613069814424540824650525e-5), + SC_(0.9066634447663091123104095458984375e-5), SC_(0.9066593345981423108474522054350755440144e-5), SC_(0.9066675549717413905283549214899456610946e-5), + SC_(0.2360353755648247897624969482421875e-4), SC_(0.2360325899737320048013584393963240356542e-4), SC_(0.236038161221667766684232806678163246188e-4), + SC_(0.60817910707555711269378662109375e-4), SC_(0.6081606137340567462263175491115417378507e-4), SC_(0.6081976015418009724388783415958425809014e-4), + SC_(0.119476739200763404369354248046875e-3), SC_(0.1194696024236052968763590872811035649465e-3), SC_(0.1194838768306258449523761123420162837989e-3), + SC_(0.2437086659483611583709716796875e-3), SC_(0.2436789738154874267053728955508067082563e-3), SC_(0.2437383653179059006664060856490910639369e-3), + SC_(0.47970912419259548187255859375e-3), SC_(0.4795941005544676642733520039561612799338e-3), SC_(0.4798242030152303995117671825532525519771e-3), + SC_(0.960788573138415813446044921875e-3), SC_(0.9603273112237537137213831663159454349065e-3), SC_(0.9612502783347382477096533911074491600195e-3), + SC_(0.113048148341476917266845703125e-2), SC_(0.112984297039538753162021050860817616211e-2), SC_(0.1131120718465376073328378699867756887911e-2), + SC_(0.33707791008055210113525390625e-2), SC_(0.3365110759179022039875145678841719780479e-2), SC_(0.3376466565278741394700008076507908493073e-2), + SC_(0.512778759002685546875e-2), SC_(0.5114685258802700303545874906083848033916e-2), SC_(0.5140957193498527263160102812012697907234e-2), + SC_(0.7697627879679203033447265625e-2), SC_(0.7668152306886386648889951166330157951323e-2), SC_(0.7727330782215801339522867700900079915854e-2), + SC_(0.154774188995361328125e-1), SC_(0.1535886535535876489145011045382406354476e-1), SC_(0.1559781448309931312470733745915557934013e-1), + SC_(0.305807329714298248291015625e-1), SC_(0.3012246177452263928099228685195389251529e-1), SC_(0.3105312667138388983748287762435717112768e-1), + SC_(0.346831791102886199951171875e-1), SC_(0.3409527271716101078966670703672108048896e-1), SC_(0.3529165481200088712490838501531684667149e-1), + SC_(0.65634094178676605224609375e-1), SC_(0.6357001557994644965537090025497140391848e-1), SC_(0.6783591829384049159063415288088650400045e-1), + SC_(0.6610882282257080078125e-1), SC_(0.6401540573272318085520396443445644947172e-1), SC_(0.6834297093791793596420077701374399081879e-1), + SC_(0.9283597767353057861328125e-1), SC_(0.8877613176091369848730538080276748892544e-1), SC_(0.9728174180292914206798492307510621372797e-1), + SC_(0.1853029727935791015625e0), SC_(0.1699984151517873986675151014366108622057e0), SC_(0.2035830378085867638230987836336350617284e0), + SC_(0.195668697357177734375e0), SC_(0.1787056082557073958655865192859050644124e0), SC_(0.2161239335120153310995245962871550390859e0), + SC_(0.218036949634552001953125e0), SC_(0.1972405051449346869157040783806052110702e0), SC_(0.2436330185556740271801313404522599276529e0), + SC_(0.22476322948932647705078125e0), SC_(0.2027475432657783430097849833923015479242e0), SC_(0.2520262382028310304455135247279894706452e0), + SC_(0.250229179859161376953125e0), SC_(0.2233268783961024315029665215194302402664e0), SC_(0.2843197231751691135236590716143900016849e0), + SC_(0.253903329372406005859375e0), SC_(0.2262613494244882135168356599690803021814e0), SC_(0.2890471852440059179173797372107595021134e0), + SC_(0.3161745369434356689453125e0), SC_(0.2747294509656754848973082105230889771257e0), SC_(0.3718696766716845552650417052219688730639e0), + SC_(0.409090220928192138671875e0), SC_(0.3429442627531700751753321547062422000484e0), SC_(0.5054475372328648428694815984023805796901e0), + SC_(0.41710007190704345703125e0), SC_(0.3486125805910782371810230966107318794672e0), SC_(0.5175543698964877990407235081110698982288e0), + SC_(0.4173481762409210205078125e0), SC_(0.3487876441750920349995178382655357863143e0), SC_(0.5179309284235235985742545616245146385983e0), + SC_(0.42039263248443603515625e0), SC_(0.3509333351432084595068912946293452186787e0), SC_(0.522559244493788135782100429719474184743e0), + SC_(0.4406131207942962646484375e0), SC_(0.3650688012994099484177768785497336743499e0), SC_(0.5536595074987176176278695373720601072416e0), + SC_(0.4500701129436492919921875e0), SC_(0.3716119090177188338876380950054248074284e0), SC_(0.5684221483289186932443765450666370231476e0), + SC_(0.4690119922161102294921875e0), SC_(0.3845900606819792767555511238898325590012e0), SC_(0.5984141671678306664208145374987554621041e0), + SC_(0.488781034946441650390625e0), SC_(0.3979576877817231446668587804772904526162e0), SC_(0.6303276957438828775174515106733850816524e0), + SC_(0.52980291843414306640625e0), SC_(0.4251389156264805389990504406429844143619e0), SC_(0.6985975133709526468615664928080778563331e0), + SC_(0.56810867786407470703125e0), SC_(0.4498702293886911216071551868503271338352e0), SC_(0.7649258494577443195036874224587751059599e0), + SC_(0.57872617244720458984375e0), SC_(0.4566183018986474768197353974513078612477e0), SC_(0.7837647742172442075416378527651943088102e0), + SC_(0.582029759883880615234375e0), SC_(0.4587086807259736626531803258754840111707e0), SC_(0.7896673415707786528734865994546559029663e0), + SC_(0.607590496540069580078125e0), SC_(0.474736471992995596813856979079879927429e0), SC_(0.836002211172822800500580737750918478977e0), + SC_(0.640033721923828125e0), SC_(0.4947168037733846594212322562172572984505e0), SC_(0.8965448333670257147748892521303229061693e0), + SC_(0.640509545803070068359375e0), SC_(0.4950068922396821400142385044888446891867e0), SC_(0.8974474694176578931586020775970152155848e0), + SC_(0.643289387226104736328125e0), SC_(0.4966999569758336894986723845165627033027e0), SC_(0.9027294105692233274199303070362746252986e0), + SC_(0.64851474761962890625e0), SC_(0.4998747295737266888041967257469236722589e0), SC_(0.9126978792095101927158614842576974964632e0), + SC_(0.650843918323516845703125e0), SC_(0.5012866228091318430397939496252397876475e0), SC_(0.9171580713331758702589264747154474769605e0), + SC_(0.65477287769317626953125e0), SC_(0.5036637653893261974582119443232408393674e0), SC_(0.9247053242168904876365979871823094489023e0), + SC_(0.65641486644744873046875e0), SC_(0.504655547804425337585747233639878779038e0), SC_(0.927868264760303541518755094801625468889e0), + SC_(0.6588299274444580078125e0), SC_(0.5061124908504770714998094003973873746865e0), SC_(0.932529810907327764547265337859703076731e0), + SC_(0.673553526401519775390625e0), SC_(0.5149492258613715166147831918156453824087e0), SC_(0.9611941077924732903931571711562687857294e0), + SC_(0.69003379344940185546875e0), SC_(0.5247485248589687068613254590642295922543e0), SC_(0.9937829089064982966773652105234409046975e0), + SC_(0.69504582881927490234375e0), SC_(0.5277097781183924897416903820415806504912e0), SC_(0.1003800903666412193968978978979482061619e1), + }; +#undef SC_ + diff --git a/test/log1p_expm1_test.cpp b/test/log1p_expm1_test.cpp index 9c3e23d6d..0d0573b78 100644 --- a/test/log1p_expm1_test.cpp +++ b/test/log1p_expm1_test.cpp @@ -3,556 +3,108 @@ // Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#include #include #include #include #include +#include +#include +#include -#include - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std{ using ::sqrt; using ::exp; } -#endif +#include "handle_test_result.hpp" // -// These test values were generated at 256-bit precision with NTL, -// we'll use these as a comparison for our own algorithms: +// DESCRIPTION: +// ~~~~~~~~~~~~ // -long double data[][3] = { - { 0.7071067811865475244008443621048490392848L, 0.5347999967395703705239932642507040249904L, 1.028114981647472451108126112746351175174L, }, - { -0.7071067811865475244008443621048490392848L, -1.227947177299515679941225385708880593066L, -0.5069313086047602121540426193848225247642L, }, - { 0.5L, 0.405465108108164381978013115464349136572L, 0.6487212707001281468486507878141635716538L, }, - { -0.5L, -0.6931471805599453094172321214581765680755L, -0.3934693402873665763962004650088195465581L, }, - { 0.3535533905932737622004221810524245196424L, 0.3027332756136080026565008168738916532429L, 0.4241190194809816004138284781974755046316L, }, - { -0.3535533905932737622004221810524245196424L, -0.4362646682381306258028444378052416278323L, -0.2978114986734404037618125202537819364955L, }, - { 0.25L, 0.2231435513142097557662950903098345033746L, 0.2840254166877414840734205680624364583363L, }, - { -0.25L, -0.2876820724517809274392190059938274315035L, -0.2211992169285951317548297330216793527032L, }, - { 0.1767766952966368811002110905262122598212L, 0.1627790866561079067978577664745092478057L, 0.1933645794479495947956947190066751660075L, }, - { -0.1767766952966368811002110905262122598212L, -0.1945277849706882079548540492230348777333L, -0.1620331144212442112773768997051282549751L, }, - { 0.125L, 0.1177830356563834545387941094705217050685L, 0.1331484530668263168290072278117938725655L, }, - { -0.125L, -0.1335313926245226231463436209313499745894L, -0.117503097415404597135107856770949263778L, }, - { 0.0883883476483184405501055452631061299106L, 0.08469802192359444824992033285217108168932L, 0.09241227540153062617063135584671815396877L, }, - { -0.0883883476483184405501055452631061299106L, -0.09254119938462034112310437534311466334391L, -0.08459468781377732889540834505145255847266L, }, - { 0.0625L, 0.0606246218164348425806061320404202632862L, 0.06449445891785942956339059464288967310073L, }, - { -0.0625L, -0.06453852113757117167292391568399292812891L, -0.06058693718652421388028917537769491547532L, }, - { 0.0441941738241592202750527726315530649553L, 0.0432454624194302551610854640871481968471L, 0.04518528280947901327000081260336002430674L, }, - { -0.0441941738241592202750527726315530649553L, -0.04520049725523360571871295632901500898476L, -0.04323183989734343213613354147207468639883L, }, - { 0.03125L, 0.0307716586667536883710282075967721640917L, 0.0317434074991026709387478152815071441945L, }, - { -0.03125L, -0.03174869831458030115699628274852562992756L, -0.03076676552365591815189080675364721639527L, }, - { 0.02209708691207961013752638631577653247765L, 0.02185648424813694627588486704954425304883L, 0.02234303578078870447841893477675632033383L, }, - { -0.02209708691207961013752638631577653247765L, -0.02234488474624582074086983060944116403229L, -0.02185473466225040063461756538971286083712L, }, - { 0.015625L, 0.01550418653596525415085404604244683587787L, 0.01574770858668574745853507208235174890672L, }, - { -0.015625L, -0.01574835696813916860754951146082826952093L, -0.01550356299459159401301117030297963029214L, }, - { 0.01104854345603980506876319315788826623883L, 0.01098795417351052684893633616419361769653L, 0.01110980401773807767277088699717081730887L, }, - { -0.01104854345603980506876319315788826623883L, -0.01111003193719750909051920695450559324905L, -0.0109877324634695920927755509825266486829L, }, - { 0.0078125L, 0.007782140442054948947462900061136763678126L, 0.007843097206447977693453559760123579193392L, }, - { -0.0078125L, -0.007843177461025892873184042490943581654592L, -0.00778206173975648789406277388638216992911L, }, - { 0.005524271728019902534381596578944133119413L, 0.005509068902949034570040757911345564446908L, 0.005539558653829430569890102084787436958606L, }, - { -0.005524271728019902534381596578944133119413L, -0.00553958694674479599776921231398085523465L, -0.005509040998094137069364339639027839483272L, }, - { 0.00390625L, 0.003898640415657323013937343095842907010724L, 0.003913889338347573443609603903460281898814L, }, - { -0.00390625L, -0.003913899321136329092317783643572664842706L, -0.003898630529882509937135338054830955713597L, }, - { 0.002762135864009951267190798289472066559706L, 0.002758328176699244507992500461404507081665L, 0.002765954075939611809020032526494603236975L, }, - { -0.002762135864009951267190798289472066559706L, -0.002765957600334472995309858879390478447378L, -0.002758324676557722165983108723111282889863L, }, - { 0.001953125L, 0.00195122013126174943967404953184153850035L, 0.001955033591002812046518898047477215867356L, }, - { -0.001953125L, -0.001955034835803350557627492241866812137664L, -0.001951218892524527289957340917326404744062L, }, - { 0.001381067932004975633595399144736033279853L, 0.001380115134839422362840066413196608682497L, 0.001382022045502678201141870910789095246896L, }, - { -0.001381067932004975633595399144736033279853L, -0.001382022485291226579353866252268409285565L, -0.001380114696566700781276188886360328730002L, }, - { 0.0009765625L, 0.0009760859730554588959608249080171866726118L, 0.0009770394924165352428452926116065064658516L, }, - { -0.0009765625L, -0.000977039647826612785968075151753465835865L, -0.0009760858180243377652882103896705696807979L, }, - { 0.0006905339660024878167976995723680166399266L, 0.0006902956571239922163465924178424595489941L, 0.0006907724394697735895620855250217767118257L, }, - { -0.0006905339660024878167976995723680166399266L, -0.0006907724943958822152082937884673220890625L, -0.0006902956022926226579739822473659270196051L, }, - { 0.00048828125L, 0.0004881620795013511885370496926454098503177L, 0.0004884004786944731261736238071633537881055L, }, - { -0.00048828125L, -0.0004884004981088744649849635598969109834608L, -0.0004881620601106346120642438969970786650047L, }, - { 0.0003452669830012439083988497861840083199633L, 0.0003452073920725940347605594851408457654352L, 0.0003453265945064500836804861194113777618491L, }, - { -0.0003452669830012439083988497861840083199633L, -0.0003453266013692502439328491689895266497932L, -0.0003452073852157150645328468804957180492811L, }, - { 0.000244140625L, 0.0002441108275273627091604790858234536994612L, 0.0002441704297478549370052339241357737575196L, }, - { -0.000244140625L, -0.0002441704321739144566954654183814336430665L, -0.0002441108251027834869064123317332192226443L, }, - { 0.0001726334915006219541994248930920041599816L, 0.0001726185920541657488047052564217192486562L, 0.0001726483935193326386701093624723297495011L, }, - { -0.0001726334915006219541994248930920041599816L, -0.0001726483943769975333358785791023362275292L, -0.0001726185911968709284892274915373687749247L, }, - { 0.0001220703125L, 0.0001220628625256773716230553671622032006662L, 0.0001220777633837710765035196704053169651876L, }, - { -0.0001220703125L, -0.0001220777636869822415828707903119755525239L, -0.0001220628622225587251301833935672790920603L, }, - { 0.8631674575031097709971244654600207999082e-4L, 0.8631302067436859538170634567406786112601e-4L, 0.8632047114779673053115205017424336944456e-4L, }, - { -0.8631674575031097709971244654600207999082e-4L, -0.8632047125499327478558483802377432851254e-4L, -0.8631302056719518077375662982669623892259e-4L, }, - { 0.6103515625e-4L, 0.6103329368063852491315878964896399244278e-4L, 0.610370189330454217791205985471093033817e-4L, }, - { -0.6103515625e-4L, -0.6103701897094392572114242980681797646601e-4L, -0.6103329364274580338274063706796778431152e-4L, }, - { 0.4315837287515548854985622327300103999541e-4L, 0.4315744157937625036775176424278410274829e-4L, 0.4315930421112837090401086653281340081162e-4L, }, - { -0.4315837287515548854985622327300103999541e-4L, -0.4315930422452721604826114516606004744788e-4L, -0.4315744156597885082640026911399617719788e-4L, }, - { 0.30517578125e-4L, 0.3051711247318637856906951416899468124305e-4L, 0.3051804379102429545128481254124317032922e-4L, }, - { -0.30517578125e-4L, -0.3051804379576142772845440263529078774196e-4L, -0.3051711246844960769262435293040988383306e-4L, }, - { 0.2157918643757774427492811163650051999771e-4L, 0.2157895361028356677465179910857365631679e-4L, 0.2157941926989617246887680913732626816569e-4L, }, - { -0.2157918643757774427492811163650051999771e-4L, -0.2157941927157098293412689381708235824685e-4L, -0.2157895360860884665958278826510182396057e-4L, }, - { 0.152587890625e-4L, 0.1525867264836239740575732513488881988266e-4L, 0.1525890547841394814004262248066173018701e-4L, }, - { -0.152587890625e-4L, -0.152589054790060783804405477297578319824e-4L, -0.1525867264777028975290466417266610381266e-4L, }, - { 0.1078959321878887213746405581825025999885e-4L, 0.1078953501154664660426995857578938351957e-4L, 0.1078965142665913183071896911252005879737e-4L, }, - { -0.1078959321878887213746405581825025999885e-4L, -0.1078965142686848031534799026109936625941e-4L, -0.1078953501133730376652725297740371278837e-4L, }, - { 0.762939453125e-5L, 0.7629365427567572155885296849132278805619e-5L, 0.7629423635154471743184330338220061308624e-5L, }, - { -0.762939453125e-5L, -0.7629423635228487317358417985971365713551e-5L, -0.7629365427493557993432788023738794879446e-5L, }, - { 0.5394796609394436068732027909125129999427e-5L, 0.5394782057531543905412357533557238337288e-5L, 0.5394811161335832678521641682790705055058e-5L, }, - { -0.5394796609394436068732027909125129999427e-5L, -0.5394811161362001062632444450174708967681e-5L, -0.5394782057505375874231949463613865956897e-5L, }, - { 0.3814697265625e-5L, 0.3814689989685889480711784976833932293351e-5L, 0.3814704541591866050787712890332329861816e-5L, }, - { -0.3814697265625e-5L, -0.3814704541601117953442710025273637313909e-5L, -0.3814689989676637666289386515234179775918e-5L, }, - { 0.2697398304697218034366013954562564999713e-5L, 0.2697394666724952981329383449389929775742e-5L, 0.2697401942679296154240372969560137048828e-5L, }, - { -0.2697398304697218034366013954562564999713e-5L, -0.2697401942682567191225066371527710701254e-5L, -0.2697394666721681966402839715630419488434e-5L, }, - { 0.19073486328125e-5L, 0.1907346813825409415469442511204082252649e-5L, 0.1907350451803060028725247653539392997757e-5L, }, - { -0.19073486328125e-5L, -0.1907350451804216513799839071800603067824e-5L, -0.1907346813824252935909388509978972352794e-5L, }, - { 0.1348699152348609017183006977281282499857e-5L, 0.1348698242854724999916487141692522749195e-5L, 0.134870006184371966849355726468816803105e-5L, }, - { -0.1348699152348609017183006977281282499857e-5L, -0.1348700061844128547427324196878709275963e-5L, -0.134869824285431612236135456375901708795e-5L, }, - { 0.95367431640625e-6L, 0.9536738616591882339084155149633361436031e-6L, 0.9536747711537454467882495568742836518855e-6L, }, - { -0.95367431640625e-6L, -0.953674771153890007250243736279163253167e-6L, -0.9536738616590436737910799241224667558785e-6L, }, - { 0.6743495761743045085915034886406412499283e-6L, 0.6743493488007312848688574744255030867349e-6L, 0.6743498035480310616127355457459842044318e-6L, }, - { -0.6743495761743045085915034886406412499283e-6L, -0.6743498035480821714363740085141941426098e-6L, -0.6743493488006801751313836587982646166511e-6L, }, - { 0.476837158203125e-6L, 0.476837044516323418443461751960488410315e-6L, 0.4768372718899807916543919475044056566776e-6L, }, - { -0.476837158203125e-6L, -0.4768372718899988617013706248625400684693e-6L, -0.476837044516305348418024236387592979885e-6L, }, - { 0.3371747880871522542957517443203206249642e-6L, 0.3371747312437461709296447293515154324249e-6L, 0.3371748449305775038268746571498812558228e-6L, }, - { -0.3371747880871522542957517443203206249642e-6L, -0.3371748449305838925521368172669692634241e-6L, -0.3371747312437397822097678596807366844562e-6L, }, - { 0.2384185791015625e-6L, 0.2384185506798575871042367946772990434454e-6L, 0.2384186075232741891586680785801190380695e-6L, }, - { -0.2384185791015625e-6L, -0.2384186075232764479138672515011331430966e-6L, -0.2384185506798553283503839443678621926131e-6L, }, - { 0.1685873940435761271478758721601603124821e-6L, 0.168587379832723009126312584887843306015e-6L, 0.168587408254431640940234436906404041751e-6L, }, - { -0.1685873940435761271478758721601603124821e-6L, -0.1685874082544324395307239165162871748373e-6L, -0.1685873798327222105361596859308544788882e-6L, }, - { 0.11920928955078125e-6L, 0.1192092824453544570875791570625307160609e-6L, 0.1192092966562088899453260246612120070545e-6L, }, - { -0.11920928955078125e-6L, -0.1192092966562091722896838486808843580911e-6L, -0.1192092824453541747433054782060819405655e-6L, }, - { 0.8429369702178806357393793608008015624104e-7L, 0.8429369346907458442100468226515995161268e-7L, 0.8429370057450184219823111772198430837325e-7L, }, - { -0.8429369702178806357393793608008015624104e-7L, -0.8429370057450194202203178452536969989128e-7L, -0.8429369346907448459722505175258045386137e-7L, }, - { 0.59604644775390625e-7L, 0.5960464299903385618582531773708049930377e-7L, 0.5960464655174749969329045951426788010322e-7L, }, - { -0.59604644775390625e-7L, -0.5960464655174753498633255797994360530379e-7L, -0.5960464299903382089278847834410624753006e-7L, }, - { 0.4214684851089403178696896804004007812052e-7L, 0.4214684762271563704279048400454781112143e-7L, 0.4214684939907246396506810043790990273791e-7L, }, - { -0.4214684851089403178696896804004007812052e-7L, -0.4214684939907247644304252640416892209222e-7L, -0.4214684762271562456481737280646416012198e-7L, }, - { 0.298023223876953125e-7L, 0.2980232194360611147319705384762092811637e-7L, 0.2980232283178452676169258265480484667506e-7L, }, - { -0.298023223876953125e-7L, -0.2980232283178453117332268061697887309516e-7L, -0.2980232194360610706156728457749074378475e-7L, }, - { 0.2107342425544701589348448402002003906026e-7L, 0.2107342403340241408794656877702442158955e-7L, 0.2107342447749162237826252139481573399431e-7L, }, - { -0.2107342425544701589348448402002003906026e-7L, -0.2107342447749162393800928355409024145238e-7L, -0.2107342403340241252819988879076087465356e-7L, }, - { 0.1490116119384765625e-7L, 0.1490116108282535489039181703572223587795e-7L, 0.1490116130486995926396939779870689685877e-7L, }, - { -0.1490116119384765625e-7L, -0.1490116130486995981542314977235185765273e-7L, -0.1490116108282535433893808560533001521451e-7L, }, - { 0.1053671212772350794674224201001001953013e-7L, 0.105367120722123571054210921755326087386e-7L, 0.1053671218323465937296840967886895134902e-7L, }, - { -0.1053671212772350794674224201001001953013e-7L, -0.1053671218323465956793675238087159758683e-7L, -0.1053671207221235691045275460934314753341e-7L, }, - { 0.7450580596923828125e-8L, 0.7450580569168252647234521144541847613178e-8L, 0.7450580624679403809560631351738427758694e-8L, }, - { -0.7450580596923828125e-8L, -0.7450580624679403878492349706467386527508e-8L, -0.7450580569168252578302804073766185102522e-8L, }, - { 0.5268356063861753973371121005005009765065e-8L, 0.5268356049983966214298749090640627494123e-8L, 0.5268356077739541805556620309161241660075e-8L, }, - { -0.5268356063861753973371121005005009765065e-8L, -0.5268356077739541829927662986417408073841e-8L, -0.5268356049983966189927706734372785144896e-8L, }, - { 0.37252902984619140625e-8L, 0.3725290291523020175825701002392130168065e-8L, 0.372529030540080797502369309976644431307e-8L, }, - { -0.37252902984619140625e-8L, -0.3725290305400807983640157853984023238563e-8L, -0.3725290291523020167209236328421632258708e-8L, }, - { 0.2634178031930876986685560502502504882532e-8L, 0.2634178028461430040824706930832094693594e-8L, 0.2634178035400323941685555007927781322226e-8L, }, - { -0.2634178031930876986685560502502504882532e-8L, -0.2634178035400323944731935332553916924003e-8L, -0.2634178028461430037778326626267729345852e-8L, }, - { 0.186264514923095703125e-8L, 0.1862645147496233557427309081102319554965e-8L, 0.1862645150965680508303865184175223522918e-8L, }, - { -0.186264514923095703125e-8L, -0.1862645150965680509380923275944699593959e-8L, -0.1862645147496233556350250994348286047433e-8L, }, - { 0.1317089015965438493342780251251252441266e-8L, 0.1317089015098076756115971781941786429449e-8L, 0.1317089016832800231711981337907007052389e-8L, }, - { -0.1317089015965438493342780251251252441266e-8L, -0.1317089016832800232092778877858343679894e-8L, -0.1317089015098076755735174243244310442822e-8L, }, - { 0.931322574615478515625e-9L, 0.9313225741817976469000627485243784799078e-9L, 0.9313225750491593847538340347920469844993e-9L, }, - { -0.931322574615478515625e-9L, -0.9313225750491593848884662961064989128669e-9L, -0.9313225741817976467654304875233917117595e-9L, }, - { 0.6585445079827192466713901256256262206331e-9L, 0.6585445077658788122694886236082174630276e-9L, 0.6585445081995596812160907048505041981019e-9L, }, - { -0.6585445079827192466713901256256262206331e-9L, -0.6585445081995596812636903973052381314413e-9L, -0.658544507765878812221888931231849819743e-9L, }, - { 0.4656612873077392578125e-9L, 0.4656612871993190405976076218769296134401e-9L, 0.465661287416159475077879476047419355854e-9L, }, - { -0.4656612873077392578125e-9L, -0.4656612874161594750947085087019300606305e-9L, -0.4656612871993190405807785892420104811773e-9L, }, - { 0.3292722539913596233356950628128131103166e-9L, 0.3292722539371495147233197642133894314689e-9L, 0.329272254045569731965920246065619388209e-9L, }, - { -0.3292722539913596233356950628128131103166e-9L, -0.32927225404556973197187020762001218331e-9L, -0.3292722539371495147173698026638945294963e-9L, }, - { 0.23283064365386962890625e-9L, 0.232830643626764574598319647310257725638e-9L, 0.2328306436809746832204912399308981321644e-9L, }, - { -0.23283064365386962890625e-9L, -0.23283064368097468322259486901209973362e-9L, -0.2328306436267645745962160182302805974645e-9L, }, - { 0.1646361269956798116678475314064065551583e-9L, 0.1646361269821272845132662163691156862891e-9L, 0.1646361270092323388246600820255233080682e-9L, }, - { -0.1646361269956798116678475314064065551583e-9L, -0.1646361270092323388254038272196693482955e-9L, -0.1646361269821272845125224711752757643824e-9L, }, - { 0.116415321826934814453125e-9L, 0.1164153218201585508756165045575548434501e-9L, 0.1164153218337110780314223563476279035653e-9L, }, - { -0.116415321826934814453125e-9L, -0.1164153218337110780316853099827398389571e-9L, -0.1164153218201585508753535509225194376384e-9L, }, - { 0.8231806349783990583392376570320327757914e-10L, 0.8231806349445177404509250064541675340615e-10L, 0.8231806350122803762303393520872760345474e-10L, }, - { -0.8231806349783990583392376570320327757914e-10L, -0.8231806350122803762312690335798629228563e-10L, -0.8231806349445177404499953249617719697029e-10L, }, - { 0.582076609134674072265625e-10L, 0.5820766091177334133211963773062890278984e-10L, 0.5820766091516147312110396988252133213646e-10L, }, - { -0.582076609134674072265625e-10L, -0.5820766091516147312113683908690793251107e-10L, -0.5820766091177334133208676852624708551399e-10L, }, - { 0.4115903174891995291696188285160163878957e-10L, 0.4115903174807291996973082454984487948242e-10L, 0.4115903174976698586422780420932622119689e-10L, }, - { -0.4115903174891995291696188285160163878957e-10L, -0.4115903174976698586423942522798295941341e-10L, -0.4115903174807291996971920353118933704059e-10L, }, - { 0.2910383045673370361328125e-10L, 0.2910383045631018713966231713156171158976e-10L, 0.2910383045715722008691250882008221724786e-10L, }, - { -0.2910383045673370361328125e-10L, -0.2910383045715722008691661747063039282285e-10L, -0.2910383045631018713965820848101383495845e-10L, }, - { 0.2057951587445997645848094142580081939479e-10L, 0.2057951587424821822167027159569772901036e-10L, 0.2057951587467173469529596913789992503469e-10L, }, - { -0.2057951587445997645848094142580081939479e-10L, -0.205795158746717346952974217652319799438e-10L, -0.2057951587424821822166881896836574883717e-10L, }, - { 0.14551915228366851806640625e-10L, 0.1455191522826097268823486462025345500282e-10L, 0.1455191522847273092504792612370204544388e-10L, }, - { -0.14551915228366851806640625e-10L, -0.1455191522847273092504843970502055804876e-10L, -0.1455191522826097268823435103893496108191e-10L, }, - { 0.1028975793722998822924047071290040969739e-10L, 0.1028975793717704867003744009854164112379e-10L, 0.1028975793728292778844404606250868251343e-10L, }, - { -0.1028975793722998822924047071290040969739e-10L, -0.1028975793728292778844422764092518704157e-10L, -0.1028975793717704867003725852012514126664e-10L, }, - { 0.72759576141834259033203125e-11L, 0.7275957614156956123718744009733740036928e-11L, 0.7275957614209895682922073583260698102783e-11L, }, - { -0.72759576141834259033203125e-11L, -0.7275957614209895682922137780925511594519e-11L, -0.7275957614156956123718679812068927712941e-11L, }, - { 0.5144878968614994114620235356450204848696e-11L, 0.5144878968601759224819432308256387682622e-11L, 0.5144878968628229004421106496550210191044e-11L, }, - { -0.5144878968614994114620235356450204848696e-11L, -0.5144878968628229004421129193852273111093e-11L, -0.514487896860175922481940961095432505451e-11L, }, - { 0.363797880709171295166015625e-11L, 0.3637978807085095506759748078017231913638e-11L, 0.3637978807098330396560588496107072890318e-11L, }, - { -0.363797880709171295166015625e-11L, -0.3637978807098330396560596520815174540293e-11L, -0.3637978807085095506759740053309130336648e-11L, }, - { 0.2572439484307497057310117678225102424348e-11L, 0.2572439484304188334859911241851132472152e-11L, 0.2572439484310805779760332626087345907701e-11L, }, - { -0.2572439484307497057310117678225102424348e-11L, -0.2572439484310805779760335463250103763584e-11L, -0.2572439484304188334859908404688374634515e-11L, }, - { 0.1818989403545856475830078125e-11L, 0.181898940354420211460497407582728258325e-11L, 0.1818989403547510837055185183438255519526e-11L, }, - { -0.1818989403545856475830078125e-11L, -0.1818989403547510837055186186526768223492e-11L, -0.1818989403544202114604973072738769883845e-11L, }, - { 0.1286219742153748528655058839112551212174e-11L, 0.1286219742152921348042506520728369264488e-11L, 0.1286219742154575709267612221432767351825e-11L, }, - { -0.1286219742153748528655058839112551212174e-11L, -0.128621974215457570926761257607811208324e-11L, -0.1286219742152921348042506166083024534213e-11L, }, - { 0.9094947017729282379150390625e-12L, 0.9094947017725146476087627994346924709042e-12L, 0.9094947017733418282213157017234997920852e-12L, }, - { -0.9094947017729282379150390625e-12L, -0.9094947017733418282213158271095638799384e-12L, -0.9094947017725146476087626740486283833361e-12L, }, - { 0.643109871076874264327529419556275606087e-12L, 0.6431098710766674691743912512988939365825e-12L, 0.6431098710770810594806677208056615496228e-12L, }, - { -0.643109871076874264327529419556275606087e-12L, -0.6431098710770810594806677651363296410141e-12L, -0.6431098710766674691743912069682258452625e-12L, }, - { 0.45474735088646411895751953125e-12L, 0.4547473508863607213809504341371570958305e-12L, 0.4547473508865675165340886753826169370521e-12L, }, - { -0.45474735088646411895751953125e-12L, -0.4547473508865675165340886910558749480249e-12L, -0.4547473508863607213809504184638990848755e-12L, }, - { 0.3215549355384371321637647097781378030435e-12L, 0.3215549355383854333754801566311253628365e-12L, 0.3215549355384888309520492795491507775067e-12L, }, - { -0.3215549355384371321637647097781378030435e-12L, -0.3215549355384888309520492850904842889284e-12L, -0.3215549355383854333754801510897918514193e-12L, }, - { 0.227373675443232059478759765625e-12L, 0.2273736754432062100846174874284747712187e-12L, 0.2273736754432579088729020496989969828922e-12L, }, - { -0.227373675443232059478759765625e-12L, -0.2273736754432579088729020516581542342633e-12L, -0.2273736754432062100846174854693175198487e-12L, }, - { 0.1607774677692185660818823548890689015218e-12L, 0.1607774677692056413848112152169824136156e-12L, 0.16077746776923149077895349663915545621e-12L, }, - { -0.1607774677692185660818823548890689015218e-12L, -0.1607774677692314907789534973318221451376e-12L, -0.1607774677692056413848112145243157246883e-12L, }, - { 0.1136868377216160297393798828125e-12L, 0.1136868377216095673908443127735793799622e-12L, 0.1136868377216224920879154535861045893017e-12L, }, - { -0.1136868377216160297393798828125e-12L, -0.1136868377216224920879154538309992457231e-12L, -0.1136868377216095673908443125286847235409e-12L, }, - { 0.8038873388460928304094117744453445076088e-13L, 0.8038873388460605186667339235334615655252e-13L, 0.8038873388461251421520896279547275331701e-13L, }, - { -0.8038873388460928304094117744453445076088e-13L, -0.8038873388461251421520896288205608943295e-13L, -0.803887338846060518666733922667628204366e-13L, }, - { 0.5684341886080801486968994140625e-13L, 0.5684341886080639928255604883529618088522e-13L, 0.5684341886080963045682383406903931527277e-13L, }, - { -0.5684341886080801486968994140625e-13L, -0.5684341886080963045682383409965114732543e-13L, -0.5684341886080639928255604880468434883256e-13L, }, - { 0.4019436694230464152047058872226722538044e-13L, 0.4019436694230383372690364242782431779937e-13L, 0.4019436694230544931403753504917888400498e-13L, }, - { -0.4019436694230464152047058872226722538044e-13L, -0.4019436694230544931403753506000180101947e-13L, -0.4019436694230383372690364241700140078488e-13L, }, - { 0.28421709430404007434844970703125e-13L, 0.2842170943040360353806149755273358720814e-13L, 0.2842170943040441133162844386499584981161e-13L, }, - { -0.28421709430404007434844970703125e-13L, -0.2842170943040441133162844386882232881819e-13L, -0.2842170943040360353806149754890710820156e-13L, }, - { 0.2009718347115232076023529436113361269022e-13L, 0.2009718347115211881184355778481715654133e-13L, 0.2009718347115252270862703094150866271954e-13L, }, - { -0.2009718347115232076023529436113361269022e-13L, -0.2009718347115252270862703094286152734636e-13L, -0.2009718347115211881184355778346429191452e-13L, }, - { 0.142108547152020037174224853515625e-13L, 0.1421085471520190274322661706300802705039e-13L, 0.1421085471520210469161835364155190257708e-13L, }, - { -0.142108547152020037174224853515625e-13L, -0.142108547152021046916183536420302124529e-13L, -0.1421085471520190274322661706252971717457e-13L, }, - { 0.1004859173557616038011764718056680634511e-13L, 0.1004859173557610989301971303614947615118e-13L, 0.1004859173557621086721558132549146077409e-13L, }, - { -0.1004859173557616038011764718056680634511e-13L, -0.1004859173557621086721558132566056885244e-13L, -0.1004859173557610989301971303598036807283e-13L, }, - { 0.710542735760100185871124267578125e-14L, 0.7105427357600976615162275603523054293642e-14L, 0.7105427357601027102260209748218811909792e-14L, }, - { -0.710542735760100185871124267578125e-14L, -0.710542735760102710226020974827860064427e-14L, -0.7105427357600976615162275603463265559164e-14L, }, - { 0.5024295867788080190058823590283403172555e-14L, 0.5024295867788067568284340054136793604486e-14L, 0.5024295867788092811833307126493428270006e-14L, }, - { -0.5024295867788080190058823590283403172555e-14L, -0.50242958677880928118333071265145667798e-14L, -0.5024295867788067568284340054115655094692e-14L, }, - { 0.3552713678800500929355621337890625e-14L, 0.3552713678800494618468379569811128889791e-14L, 0.3552713678800507240242863105992541885638e-14L, }, - { -0.3552713678800500929355621337890625e-14L, -0.3552713678800507240242863106000015477448e-14L, -0.3552713678800494618468379569803655297981e-14L, }, - { 0.2512147933894040095029411795141701586277e-14L, 0.2512147933894036939585790911099764566812e-14L, 0.2512147933894043250473032679191565546916e-14L, }, - { -0.2512147933894040095029411795141701586277e-14L, -0.251214793389404325047303267919420786064e-14L, -0.2512147933894036939585790911097122253087e-14L, }, - { 0.17763568394002504646778106689453125e-14L, 0.1776356839400248886956000226923570074495e-14L, 0.1776356839400252042399621110969857522433e-14L, }, - { -0.17763568394002504646778106689453125e-14L, -0.177635683940025204239962111097079172141e-14L, -0.1776356839400248886956000226922635875519e-14L, }, - { 0.1256073966947020047514705897570850793139e-14L, 0.1256073966947019258653800676559705959841e-14L, 0.1256073966947020836375611118582986494083e-14L, }, - { -0.1256073966947020047514705897570850793139e-14L, -0.1256073966947020836375611118583316783298e-14L, -0.1256073966947019258653800676559375670626e-14L, }, - { 0.88817841970012523233890533447265625e-15L, 0.8881784197001248379084527239669870938798e-15L, 0.8881784197001256267693579449786757307363e-15L, }, - { -0.88817841970012523233890533447265625e-15L, -0.8881784197001256267693579449787925056083e-15L, -0.8881784197001248379084527239668703190077e-15L, }, - { 0.6280369834735100237573529487854253965694e-15L, 0.6280369834735098265421266435325566159411e-15L, 0.6280369834735102209725792540384180356535e-15L, }, - { -0.6280369834735100237573529487854253965694e-15L, -0.6280369834735102209725792540384593218054e-15L, -0.6280369834735098265421266435325153297892e-15L, }, - { 0.444089209850062616169452667236328125e-15L, 0.4440892098500625175618395146098816422519e-15L, 0.4440892098500627147770658198628183983251e-15L, }, - { -0.444089209850062616169452667236328125e-15L, -0.4440892098500627147770658198628329951841e-15L, -0.4440892098500625175618395146098670453929e-15L, }, - { 0.3140184917367550118786764743927126982847e-15L, 0.3140184917367549625748698980794851815896e-15L, 0.3140184917367550611824830507059556972867e-15L, }, - { -0.3140184917367550118786764743927126982847e-15L, -0.3140184917367550611824830507059608580557e-15L, -0.3140184917367549625748698980794800208206e-15L, }, - { 0.2220446049250313080847263336181640625e-15L, 0.2220446049250312834328230454615487925982e-15L, 0.2220446049250313327366296217747848062239e-15L, }, - { -0.2220446049250313080847263336181640625e-15L, -0.2220446049250313327366296217747866308313e-15L, -0.2220446049250312834328230454615469679909e-15L, }, - { 0.1570092458683775059393382371963563491423e-15L, 0.1570092458683774936133865931180481797763e-15L, 0.1570092458683775182652898812746664537967e-15L, }, - { -0.1570092458683775059393382371963563491423e-15L, -0.1570092458683775182652898812746670988928e-15L, -0.1570092458683774936133865931180475346802e-15L, }, - { 0.11102230246251565404236316680908203125e-15L, 0.1110223024625156478793873447699277576227e-15L, 0.1110223024625156602053389888482369891051e-15L, }, - { -0.11102230246251565404236316680908203125e-15L, -0.111022302462515660205338988848237217181e-15L, -0.1110223024625156478793873447699275295468e-15L, }, - { 0.7850462293418875296966911859817817457117e-16L, 0.7850462293418874988818120757860097095564e-16L, 0.7850462293418875605115702961775562009775e-16L, }, - { -0.7850462293418875296966911859817817457117e-16L, -0.7850462293418875605115702961775570073477e-16L, -0.7850462293418874988818120757860089031862e-16L, }, - { 0.55511151231257827021181583404541015625e-16L, 0.555111512312578254804376278947523901992e-16L, 0.5551115123125782856192553891432972657927e-16L, }, - { -0.55511151231257827021181583404541015625e-16L, -0.5551115123125782856192553891432975508876e-16L, -0.5551115123125782548043762789475236168971e-16L, }, - { 0.3925231146709437648483455929908908728559e-16L, 0.3925231146709437571446258154419476622245e-16L, 0.392523114670943772552065370539834385876e-16L, }, - { -0.3925231146709437648483455929908908728559e-16L, -0.3925231146709437725520653705398344866723e-16L, -0.3925231146709437571446258154419475614282e-16L, }, - { 0.277555756156289135105907917022705078125e-16L, 0.2775557561562891312540480282482334432868e-16L, 0.2775557561562891389577678057971768198738e-16L, }, - { -0.277555756156289135105907917022705078125e-16L, -0.2775557561562891389577678057971768555107e-16L, -0.2775557561562891312540480282482334076499e-16L, }, - { 0.1962615573354718824241727964954454364279e-16L, 0.196261557335471880498242852108209608571e-16L, 0.1962615573354718843501027408826813020834e-16L, }, - { -0.1962615573354718824241727964954454364279e-16L, -0.196261557335471884350102740882681314683e-16L, -0.1962615573354718804982428521082095959715e-16L, }, - { 0.1387778780781445675529539585113525390625e-16L, 0.1387778780781445665899889863177346214437e-16L, 0.1387778780781445685159189307049704700451e-16L, }, - { -0.1387778780781445675529539585113525390625e-16L, -0.1387778780781445685159189307049704744997e-16L, -0.1387778780781445665899889863177346169891e-16L, }, - { 0.9813077866773594121208639824772271821396e-17L, 0.9813077866773594073060391215091375809985e-17L, 0.981307786677359416935688843445316830529e-17L, }, - { -0.9813077866773594121208639824772271821396e-17L, -0.9813077866773594169356888434453168462784e-17L, -0.9813077866773594073060391215091375652491e-17L, }, - { 0.6938893903907228377647697925567626953125e-17L, 0.693889390390722835357357362072717890129e-17L, 0.6938893903907228401721822230408075172007e-17L, }, - { -0.6938893903907228377647697925567626953125e-17L, -0.693889390390722840172182223040807522769e-17L, -0.6938893903907228353573573620727178845608e-17L, }, - { 0.4906538933386797060604319912386135910698e-17L, 0.4906538933386797048567257759965911868472e-17L, 0.4906538933386797072641382064806360011985e-17L, }, - { -0.4906538933386797060604319912386135910698e-17L, -0.4906538933386797072641382064806360031672e-17L, -0.4906538933386797048567257759965911848785e-17L, }, - { 0.3469446951953614188823848962783813476563e-17L, 0.3469446951953614182805317886573701449683e-17L, 0.3469446951953614194842380038993925524323e-17L, }, - { -0.3469446951953614188823848962783813476563e-17L, -0.3469446951953614194842380038993925531283e-17L, -0.3469446951953614182805317886573701442723e-17L, }, - { 0.2453269466693398530302159956193067955349e-17L, 0.2453269466693398527292894418088011939871e-17L, 0.245326946669339853331142549429812397821e-17L, }, - { -0.2453269466693398530302159956193067955349e-17L, -0.2453269466693398533311425494298123980671e-17L, -0.245326946669339852729289441808801193741e-17L, }, - { 0.1734723475976807094411924481391906738281e-17L, 0.1734723475976807092907291712339378729821e-17L, 0.1734723475976807095916557250444434749351e-17L, }, - { -0.1734723475976807094411924481391906738281e-17L, -0.1734723475976807095916557250444434750221e-17L, -0.1734723475976807092907291712339378728951e-17L, }, - { 0.1226634733346699265151079978096533977675e-17L, 0.122663473334669926439876359357026997319e-17L, 0.1226634733346699265903396362622797983082e-17L, }, - { -0.1226634733346699265151079978096533977675e-17L, -0.122663473334669926590339636262279798339e-17L, -0.1226634733346699264398763593570269972882e-17L, }, - { 0.8673617379884035472059622406959533691406e-18L, 0.8673617379884035468298040484328213668081e-18L, 0.8673617379884035475821204329590853717994e-18L, }, - { -0.8673617379884035472059622406959533691406e-18L, -0.8673617379884035475821204329590853719081e-18L, -0.8673617379884035468298040484328213666994e-18L, }, - { 0.6133173666733496325755399890482669888373e-18L, 0.6133173666733496323874608929167009876392e-18L, 0.6133173666733496327636190851798329901507e-18L, }, - { -0.6133173666733496325755399890482669888373e-18L, -0.6133173666733496327636190851798329901892e-18L, -0.6133173666733496323874608929167009876007e-18L, }, - { 0.4336808689942017736029811203479766845703e-18L, 0.43368086899420177350894157228219368396e-18L, 0.4336808689942017736970206684137596852214e-18L, }, - { -0.4336808689942017736029811203479766845703e-18L, -0.433680868994201773697020668413759685235e-18L, -0.4336808689942017735089415722821936839464e-18L, }, - { 0.3066586833366748162877699945241334944186e-18L, 0.3066586833366748162407502204912419941095e-18L, 0.3066586833366748163347897685570249947422e-18L, }, - { -0.3066586833366748162877699945241334944186e-18L, -0.306658683336674816334789768557024994747e-18L, -0.3066586833366748162407502204912419941047e-18L, }, - { 0.2168404344971008868014905601739883422852e-18L, 0.2168404344971008867779806731575425921292e-18L, 0.2168404344971008868250004471904340924462e-18L, }, - { -0.2168404344971008868014905601739883422852e-18L, -0.2168404344971008868250004471904340924479e-18L, -0.2168404344971008867779806731575425921275e-18L, }, - { 0.1533293416683374081438849972620667472093e-18L, 0.1533293416683374081321300537538438721308e-18L, 0.1533293416683374081556399407702896222896e-18L, }, - { -0.1533293416683374081438849972620667472093e-18L, -0.1533293416683374081556399407702896222902e-18L, -0.1533293416683374081321300537538438721302e-18L, }, - { 0.1084202172485504434007452800869941711426e-18L, 0.1084202172485504433948678083328827336032e-18L, 0.1084202172485504434066227518411056086826e-18L, }, - { -0.1084202172485504434007452800869941711426e-18L, -0.1084202172485504434066227518411056086828e-18L, -0.1084202172485504433948678083328827336029e-18L, }, - { 0.7666467083416870407194249863103337360466e-19L, 0.7666467083416870406900376275397765483489e-19L, 0.7666467083416870407488123450808909237466e-19L, }, - { -0.7666467083416870407194249863103337360466e-19L, -0.7666467083416870407488123450808909237473e-19L, -0.7666467083416870406900376275397765483481e-19L, }, - { 0.5421010862427522170037264004349708557129e-19L, 0.5421010862427522169890327210496922618638e-19L, 0.5421010862427522170184200798202494495628e-19L, }, - { -0.5421010862427522170037264004349708557129e-19L, -0.542101086242752217018420079820249449563e-19L, -0.5421010862427522169890327210496922618635e-19L, }, - { 0.3833233541708435203597124931551668680233e-19L, 0.3833233541708435203523656534625275710987e-19L, 0.3833233541708435203670593328478061649482e-19L, }, - { -0.3833233541708435203597124931551668680233e-19L, -0.3833233541708435203670593328478061649483e-19L, -0.3833233541708435203523656534625275710986e-19L, }, - { 0.2710505431213761085018632002174854278564e-19L, 0.2710505431213761084981897803711657793941e-19L, 0.2710505431213761085055366200638050763189e-19L, }, - { -0.2710505431213761085018632002174854278564e-19L, -0.2710505431213761085055366200638050763189e-19L, -0.2710505431213761084981897803711657793941e-19L, }, - { 0.1916616770854217601798562465775834340116e-19L, 0.1916616770854217601780195366544236097805e-19L, 0.1916616770854217601816929565007432582429e-19L, }, - { -0.1916616770854217601798562465775834340116e-19L, -0.1916616770854217601816929565007432582429e-19L, -0.1916616770854217601780195366544236097805e-19L, }, - { 0.1355252715606880542509316001087427139282e-19L, 0.1355252715606880542500132451471628018126e-19L, 0.1355252715606880542518499550703226260438e-19L, }, - { -0.1355252715606880542509316001087427139282e-19L, -0.1355252715606880542518499550703226260438e-19L, -0.1355252715606880542500132451471628018126e-19L, }, - { 0.9583083854271088008992812328879171700582e-20L, 0.9583083854271088008946894580800176094803e-20L, 0.9583083854271088009038730076958167306363e-20L, }, - { -0.9583083854271088008992812328879171700582e-20L, -0.9583083854271088009038730076958167306363e-20L, -0.9583083854271088008946894580800176094803e-20L, }, - { 0.6776263578034402712546580005437135696411e-20L, 0.6776263578034402712523621131397637893521e-20L, 0.6776263578034402712569538879476633499301e-20L, }, - { -0.6776263578034402712546580005437135696411e-20L, -0.6776263578034402712569538879476633499301e-20L, -0.6776263578034402712523621131397637893521e-20L, }, - { 0.4791541927135544004496406164439585850291e-20L, 0.4791541927135544004484926727419836948846e-20L, 0.4791541927135544004507885601459334751736e-20L, }, - { -0.4791541927135544004496406164439585850291e-20L, -0.4791541927135544004507885601459334751736e-20L, -0.4791541927135544004484926727419836948846e-20L, }, - { 0.3388131789017201356273290002718567848206e-20L, 0.3388131789017201356267550284208693397483e-20L, 0.3388131789017201356279029721228442298928e-20L, }, - { -0.3388131789017201356273290002718567848206e-20L, -0.3388131789017201356279029721228442298928e-20L, -0.3388131789017201356267550284208693397483e-20L, }, - { 0.2395770963567772002248203082219792925146e-20L, 0.2395770963567772002245333222964855699784e-20L, 0.2395770963567772002251072941474730150507e-20L, }, - { -0.2395770963567772002248203082219792925146e-20L, -0.2395770963567772002251072941474730150507e-20L, -0.2395770963567772002245333222964855699784e-20L, }, - { 0.1694065894508600678136645001359283924103e-20L, 0.1694065894508600678135210071731815311422e-20L, 0.1694065894508600678138079930986752536783e-20L, }, - { -0.1694065894508600678136645001359283924103e-20L, -0.1694065894508600678138079930986752536783e-20L, -0.1694065894508600678135210071731815311422e-20L, }, - { 0.1197885481783886001124101541109896462573e-20L, 0.1197885481783886001123384076296162156232e-20L, 0.1197885481783886001124819005923630768913e-20L, }, - { -0.1197885481783886001124101541109896462573e-20L, -0.1197885481783886001124819005923630768913e-20L, -0.1197885481783886001123384076296162156232e-20L, }, - { 0.8470329472543003390683225006796419620514e-21L, 0.8470329472543003390679637682727748088812e-21L, 0.8470329472543003390686812330865091152215e-21L, }, - { -0.8470329472543003390683225006796419620514e-21L, -0.8470329472543003390686812330865091152215e-21L, -0.8470329472543003390679637682727748088812e-21L, }, - { 0.5989427408919430005620507705549482312864e-21L, 0.5989427408919430005618714043515146547013e-21L, 0.5989427408919430005622301367583818078715e-21L, }, - { -0.5989427408919430005620507705549482312864e-21L, -0.5989427408919430005622301367583818078715e-21L, -0.5989427408919430005618714043515146547013e-21L, }, - { 0.4235164736271501695341612503398209810257e-21L, 0.4235164736271501695340715672381041927332e-21L, 0.4235164736271501695342509334415377693182e-21L, }, - { -0.4235164736271501695341612503398209810257e-21L, -0.4235164736271501695342509334415377693182e-21L, -0.4235164736271501695340715672381041927332e-21L, }, - { 0.2994713704459715002810253852774741156432e-21L, 0.2994713704459715002809805437266157214969e-21L, 0.2994713704459715002810702268283325097895e-21L, }, - { -0.2994713704459715002810253852774741156432e-21L, -0.2994713704459715002810702268283325097895e-21L, -0.2994713704459715002809805437266157214969e-21L, }, - { 0.2117582368135750847670806251699104905128e-21L, 0.2117582368135750847670582043944812934397e-21L, 0.211758236813575084767103045945339687586e-21L, }, - { -0.2117582368135750847670806251699104905128e-21L, -0.211758236813575084767103045945339687586e-21L, -0.2117582368135750847670582043944812934397e-21L, }, - { 0.1497356852229857501405126926387370578216e-21L, 0.149735685222985750140501482251022459285e-21L, 0.1497356852229857501405239030264516563582e-21L, }, - { -0.1497356852229857501405126926387370578216e-21L, -0.1497356852229857501405239030264516563582e-21L, -0.149735685222985750140501482251022459285e-21L, }, - { 0.1058791184067875423835403125849552452564e-21L, 0.1058791184067875423835347073910979459881e-21L, 0.1058791184067875423835459177788125445247e-21L, }, - { -0.1058791184067875423835403125849552452564e-21L, -0.1058791184067875423835459177788125445247e-21L, -0.1058791184067875423835347073910979459881e-21L, }, - { 0.748678426114928750702563463193685289108e-22L, 0.7486784261149287507025354372243987927666e-22L, 0.7486784261149287507025914891629717854494e-22L, }, - { -0.748678426114928750702563463193685289108e-22L, -0.7486784261149287507025914891629717854494e-22L, -0.7486784261149287507025354372243987927666e-22L, }, - { 0.5293955920339377119177015629247762262821e-22L, 0.5293955920339377119176875499401329781114e-22L, 0.5293955920339377119177155759094194744528e-22L, }, - { -0.5293955920339377119177015629247762262821e-22L, -0.5293955920339377119177155759094194744528e-22L, -0.5293955920339377119176875499401329781114e-22L, }, - { 0.374339213057464375351281731596842644554e-22L, 0.3743392130574643753512747251045210204686e-22L, 0.3743392130574643753512887380891642686394e-22L, }, - { -0.374339213057464375351281731596842644554e-22L, -0.3743392130574643753512887380891642686394e-22L, -0.3743392130574643753512747251045210204686e-22L, }, - { 0.2646977960169688559588507814623881131411e-22L, 0.2646977960169688559588472782162273010984e-22L, 0.2646977960169688559588542847085489251837e-22L, }, - { -0.2646977960169688559588507814623881131411e-22L, -0.2646977960169688559588542847085489251837e-22L, -0.2646977960169688559588472782162273010984e-22L, }, - { 0.187169606528732187675640865798421322277e-22L, 0.1871696065287321876756391141753409162557e-22L, 0.1871696065287321876756426174215017282983e-22L, }, - { -0.187169606528732187675640865798421322277e-22L, -0.1871696065287321876756426174215017282983e-22L, -0.1871696065287321876756391141753409162557e-22L, }, - { 0.1323488980084844279794253907311940565705e-22L, 0.1323488980084844279794245149196538535599e-22L, 0.1323488980084844279794262665427342595812e-22L, }, - { -0.1323488980084844279794253907311940565705e-22L, -0.1323488980084844279794262665427342595812e-22L, -0.1323488980084844279794245149196538535599e-22L, }, - { 0.935848032643660938378204328992106611385e-23L, 0.9358480326436609383781999499344055963317e-23L, 0.9358480326436609383782087080498076264383e-23L, }, - { -0.935848032643660938378204328992106611385e-23L, -0.9358480326436609383782087080498076264383e-23L, -0.9358480326436609383781999499344055963317e-23L, }, - { 0.6617444900424221398971269536559702828526e-23L, 0.661744490042422139897124764127119775326e-23L, 0.6617444900424221398971291431848207903793e-23L, }, - { -0.6617444900424221398971269536559702828526e-23L, -0.6617444900424221398971291431848207903793e-23L, -0.661744490042422139897124764127119775326e-23L, }, - { 0.4679240163218304691891021644960533056925e-23L, 0.4679240163218304691891010697316280519292e-23L, 0.4679240163218304691891032592604785594558e-23L, }, - { -0.4679240163218304691891021644960533056925e-23L, -0.4679240163218304691891032592604785594558e-23L, -0.4679240163218304691891010697316280519292e-23L, }, - { 0.3308722450212110699485634768279851414263e-23L, 0.3308722450212110699485629294457725145447e-23L, 0.330872245021211069948564024210197768308e-23L, }, - { -0.3308722450212110699485634768279851414263e-23L, -0.330872245021211069948564024210197768308e-23L, -0.3308722450212110699485629294457725145447e-23L, }, - { 0.2339620081609152345945510822480266528463e-23L, 0.2339620081609152345945508085569203394054e-23L, 0.2339620081609152345945513559391329662871e-23L, }, - { -0.2339620081609152345945510822480266528463e-23L, -0.2339620081609152345945513559391329662871e-23L, -0.2339620081609152345945508085569203394054e-23L, }, - { 0.1654361225106055349742817384139925707132e-23L, 0.1654361225106055349742816015684394139927e-23L, 0.1654361225106055349742818752595457274336e-23L, }, - { -0.1654361225106055349742817384139925707132e-23L, -0.1654361225106055349742818752595457274336e-23L, -0.1654361225106055349742816015684394139927e-23L, }, - { 0.1169810040804576172972755411240133264231e-23L, 0.1169810040804576172972754727012367480629e-23L, 0.1169810040804576172972756095467899047833e-23L, }, - { -0.1169810040804576172972755411240133264231e-23L, -0.1169810040804576172972756095467899047833e-23L, -0.1169810040804576172972754727012367480629e-23L, }, - { 0.8271806125530276748714086920699628535658e-24L, 0.8271806125530276748714083499560799617648e-24L, 0.8271806125530276748714090341838457453669e-24L, }, - { -0.8271806125530276748714086920699628535658e-24L, -0.8271806125530276748714090341838457453669e-24L, -0.8271806125530276748714083499560799617648e-24L, }, - { 0.5849050204022880864863777056200666321156e-24L, 0.5849050204022880864863775345631251862151e-24L, 0.5849050204022880864863778766770080780161e-24L, }, - { -0.5849050204022880864863777056200666321156e-24L, -0.5849050204022880864863778766770080780161e-24L, -0.5849050204022880864863775345631251862151e-24L, }, - { 0.4135903062765138374357043460349814267829e-24L, 0.4135903062765138374357042605065107038326e-24L, 0.4135903062765138374357044315634521497332e-24L, }, - { -0.4135903062765138374357043460349814267829e-24L, -0.4135903062765138374357044315634521497332e-24L, -0.4135903062765138374357042605065107038326e-24L, }, - { 0.2924525102011440432431888528100333160578e-24L, 0.2924525102011440432431888100457979545827e-24L, 0.2924525102011440432431888955742686775329e-24L, }, - { -0.2924525102011440432431888528100333160578e-24L, -0.2924525102011440432431888955742686775329e-24L, -0.2924525102011440432431888100457979545827e-24L, }, - { 0.2067951531382569187178521730174907133915e-24L, 0.2067951531382569187178521516353730326539e-24L, 0.206795153138256918717852194399608394129e-24L, }, - { -0.2067951531382569187178521730174907133915e-24L, -0.206795153138256918717852194399608394129e-24L, -0.2067951531382569187178521516353730326539e-24L, }, - { 0.1462262551005720216215944264050166580289e-24L, 0.1462262551005720216215944157139578176601e-24L, 0.1462262551005720216215944370960754983977e-24L, }, - { -0.1462262551005720216215944264050166580289e-24L, -0.1462262551005720216215944370960754983977e-24L, -0.1462262551005720216215944157139578176601e-24L, }, - { 0.1033975765691284593589260865087453566957e-24L, 0.1033975765691284593589260811632159365113e-24L, 0.1033975765691284593589260918542747768801e-24L, }, - { -0.1033975765691284593589260865087453566957e-24L, -0.1033975765691284593589260918542747768801e-24L, -0.1033975765691284593589260811632159365113e-24L, }, - { 0.7311312755028601081079721320250832901445e-25L, 0.7311312755028601081079721052974361892226e-25L, 0.7311312755028601081079721587527303910665e-25L, }, - { -0.7311312755028601081079721320250832901445e-25L, -0.7311312755028601081079721587527303910665e-25L, -0.7311312755028601081079721052974361892226e-25L, }, - { 0.5169878828456422967946304325437267834786e-25L, 0.5169878828456422967946304191799032330177e-25L, 0.5169878828456422967946304459075503339396e-25L, }, - { -0.5169878828456422967946304325437267834786e-25L, -0.5169878828456422967946304459075503339396e-25L, -0.5169878828456422967946304191799032330177e-25L, }, - { 0.3655656377514300540539860660125416450723e-25L, 0.3655656377514300540539860593306298698418e-25L, 0.3655656377514300540539860726944534203028e-25L, }, - { -0.3655656377514300540539860660125416450723e-25L, -0.3655656377514300540539860726944534203028e-25L, -0.3655656377514300540539860593306298698418e-25L, }, - { 0.2584939414228211483973152162718633917393e-25L, 0.2584939414228211483973152129309075041241e-25L, 0.2584939414228211483973152196128192793546e-25L, }, - { -0.2584939414228211483973152162718633917393e-25L, -0.2584939414228211483973152196128192793546e-25L, -0.2584939414228211483973152129309075041241e-25L, }, - { 0.1827828188757150270269930330062708225361e-25L, 0.1827828188757150270269930313357928787285e-25L, 0.1827828188757150270269930346767487663438e-25L, }, - { -0.1827828188757150270269930330062708225361e-25L, -0.1827828188757150270269930346767487663438e-25L, -0.1827828188757150270269930313357928787285e-25L, }, - { 0.1292469707114105741986576081359316958697e-25L, 0.1292469707114105741986576073006927239658e-25L, 0.1292469707114105741986576089711706677735e-25L, }, - { -0.1292469707114105741986576081359316958697e-25L, -0.1292469707114105741986576089711706677735e-25L, -0.1292469707114105741986576073006927239658e-25L, }, - { 0.9139140943785751351349651650313541126807e-26L, 0.9139140943785751351349651608551592531616e-26L, 0.9139140943785751351349651692075489721997e-26L, }, - { -0.9139140943785751351349651650313541126807e-26L, -0.9139140943785751351349651692075489721997e-26L, -0.9139140943785751351349651608551592531616e-26L, }, - { 0.6462348535570528709932880406796584793483e-26L, 0.6462348535570528709932880385915610495888e-26L, 0.6462348535570528709932880427677559091078e-26L, }, - { -0.6462348535570528709932880406796584793483e-26L, -0.6462348535570528709932880427677559091078e-26L, -0.6462348535570528709932880385915610495888e-26L, }, - { 0.4569570471892875675674825825156770563403e-26L, 0.4569570471892875675674825814716283414606e-26L, 0.4569570471892875675674825835597257712201e-26L, }, - { -0.4569570471892875675674825825156770563403e-26L, -0.4569570471892875675674825835597257712201e-26L, -0.4569570471892875675674825814716283414606e-26L, }, - { 0.3231174267785264354966440203398292396741e-26L, 0.3231174267785264354966440198178048822343e-26L, 0.323117426778526435496644020861853597114e-26L, }, - { -0.3231174267785264354966440203398292396741e-26L, -0.323117426778526435496644020861853597114e-26L, -0.3231174267785264354966440198178048822343e-26L, }, - { 0.2284785235946437837837412912578385281702e-26L, 0.2284785235946437837837412909968263494502e-26L, 0.2284785235946437837837412915188507068901e-26L, }, - { -0.2284785235946437837837412912578385281702e-26L, -0.2284785235946437837837412915188507068901e-26L, -0.2284785235946437837837412909968263494502e-26L, }, - { 0.1615587133892632177483220101699146198371e-26L, 0.1615587133892632177483220100394085304771e-26L, 0.161558713389263217748322010300420709197e-26L, }, - { -0.1615587133892632177483220101699146198371e-26L, -0.161558713389263217748322010300420709197e-26L, -0.1615587133892632177483220100394085304771e-26L, }, - { 0.1142392617973218918918706456289192640851e-26L, 0.1142392617973218918918706455636662194051e-26L, 0.1142392617973218918918706456941723087651e-26L, }, - { -0.1142392617973218918918706456289192640851e-26L, -0.1142392617973218918918706456941723087651e-26L, -0.1142392617973218918918706455636662194051e-26L, }, - { 0.8077935669463160887416100508495730991854e-27L, 0.8077935669463160887416100505233078757854e-27L, 0.8077935669463160887416100511758383225853e-27L, }, - { -0.8077935669463160887416100508495730991854e-27L, -0.8077935669463160887416100511758383225853e-27L, -0.8077935669463160887416100505233078757854e-27L, }, - { 0.5711963089866094594593532281445963204254e-27L, 0.5711963089866094594593532279814637087255e-27L, 0.5711963089866094594593532283077289321254e-27L, }, - { -0.5711963089866094594593532281445963204254e-27L, -0.5711963089866094594593532283077289321254e-27L, -0.5711963089866094594593532279814637087255e-27L, }, - { 0.4038967834731580443708050254247865495927e-27L, 0.4038967834731580443708050253432202437427e-27L, 0.4038967834731580443708050255063528554427e-27L, }, - { -0.4038967834731580443708050254247865495927e-27L, -0.4038967834731580443708050255063528554427e-27L, -0.4038967834731580443708050253432202437427e-27L, }, - { 0.2855981544933047297296766140722981602127e-27L, 0.2855981544933047297296766140315150072877e-27L, 0.2855981544933047297296766141130813131377e-27L, }, - { -0.2855981544933047297296766140722981602127e-27L, -0.2855981544933047297296766141130813131377e-27L, -0.2855981544933047297296766140315150072877e-27L, }, - { 0.2019483917365790221854025127123932747963e-27L, 0.2019483917365790221854025126920016983338e-27L, 0.2019483917365790221854025127327848512588e-27L, }, - { -0.2019483917365790221854025127123932747963e-27L, -0.2019483917365790221854025127327848512588e-27L, -0.2019483917365790221854025126920016983338e-27L, }, - { 0.1427990772466523648648383070361490801064e-27L, 0.1427990772466523648648383070259532918751e-27L, 0.1427990772466523648648383070463448683376e-27L, }, - { -0.1427990772466523648648383070361490801064e-27L, -0.1427990772466523648648383070463448683376e-27L, -0.1427990772466523648648383070259532918751e-27L, }, - { 0.1009741958682895110927012563561966373982e-27L, 0.1009741958682895110927012563510987432825e-27L, 0.1009741958682895110927012563612945315138e-27L, }, - { -0.1009741958682895110927012563561966373982e-27L, -0.1009741958682895110927012563612945315138e-27L, -0.1009741958682895110927012563510987432825e-27L, }, - { 0.7139953862332618243241915351807454005318e-28L, 0.7139953862332618243241915351552559299537e-28L, 0.7139953862332618243241915352062348711099e-28L, }, - { -0.7139953862332618243241915351807454005318e-28L, -0.7139953862332618243241915352062348711099e-28L, -0.7139953862332618243241915351552559299537e-28L, }, - { 0.5048709793414475554635062817809831869909e-28L, 0.5048709793414475554635062817682384517018e-28L, 0.5048709793414475554635062817937279222799e-28L, }, - { -0.5048709793414475554635062817809831869909e-28L, -0.5048709793414475554635062817937279222799e-28L, -0.5048709793414475554635062817682384517018e-28L, }, - { 0.3569976931166309121620957675903727002659e-28L, 0.3569976931166309121620957675840003326214e-28L, 0.3569976931166309121620957675967450679104e-28L, }, - { -0.3569976931166309121620957675903727002659e-28L, -0.3569976931166309121620957675967450679104e-28L, -0.3569976931166309121620957675840003326214e-28L, }, - { 0.2524354896707237777317531408904915934954e-28L, 0.2524354896707237777317531408873054096732e-28L, 0.2524354896707237777317531408936777773177e-28L, }, - { -0.2524354896707237777317531408904915934954e-28L, -0.2524354896707237777317531408936777773177e-28L, -0.2524354896707237777317531408873054096732e-28L, }, - { 0.1784988465583154560810478837951863501329e-28L, 0.1784988465583154560810478837935932582218e-28L, 0.1784988465583154560810478837967794420441e-28L, }, - { -0.1784988465583154560810478837951863501329e-28L, -0.1784988465583154560810478837967794420441e-28L, -0.1784988465583154560810478837935932582218e-28L, }, - { 0.1262177448353618888658765704452457967477e-28L, 0.1262177448353618888658765704444492507921e-28L, 0.1262177448353618888658765704460423427033e-28L, }, - { -0.1262177448353618888658765704452457967477e-28L, -0.1262177448353618888658765704460423427033e-28L, -0.1262177448353618888658765704444492507921e-28L, }, - { 0.8924942327915772804052394189759317506647e-29L, 0.8924942327915772804052394189719490208869e-29L, 0.8924942327915772804052394189799144804425e-29L, }, - { -0.8924942327915772804052394189759317506647e-29L, -0.8924942327915772804052394189799144804425e-29L, -0.8924942327915772804052394189719490208869e-29L, }, - { 0.6310887241768094443293828522262289837386e-29L, 0.6310887241768094443293828522242376188496e-29L, 0.6310887241768094443293828522282203486275e-29L, }, - { -0.6310887241768094443293828522262289837386e-29L, -0.6310887241768094443293828522282203486275e-29L, -0.6310887241768094443293828522242376188496e-29L, }, - { 0.4462471163957886402026197094879658753324e-29L, 0.4462471163957886402026197094869701928879e-29L, 0.4462471163957886402026197094889615577768e-29L, }, - { -0.4462471163957886402026197094879658753324e-29L, -0.4462471163957886402026197094889615577768e-29L, -0.4462471163957886402026197094869701928879e-29L, }, - { 0.3155443620884047221646914261131144918693e-29L, 0.3155443620884047221646914261126166506471e-29L, 0.3155443620884047221646914261136123330915e-29L, }, - { -0.3155443620884047221646914261131144918693e-29L, -0.3155443620884047221646914261136123330915e-29L, -0.3155443620884047221646914261126166506471e-29L, }, - { 0.2231235581978943201013098547439829376662e-29L, 0.2231235581978943201013098547437340170551e-29L, 0.2231235581978943201013098547442318582773e-29L, }, - { -0.2231235581978943201013098547439829376662e-29L, -0.2231235581978943201013098547442318582773e-29L, -0.2231235581978943201013098547437340170551e-29L, }, - { 0.1577721810442023610823457130565572459346e-29L, 0.1577721810442023610823457130564327856291e-29L, 0.1577721810442023610823457130566817062402e-29L, }, - { -0.1577721810442023610823457130565572459346e-29L, -0.1577721810442023610823457130566817062402e-29L, -0.1577721810442023610823457130564327856291e-29L, }, - { 0.1115617790989471600506549273719914688331e-29L, 0.1115617790989471600506549273719292386803e-29L, 0.1115617790989471600506549273720536989859e-29L, }, - { -0.1115617790989471600506549273719914688331e-29L, -0.1115617790989471600506549273720536989859e-29L, -0.1115617790989471600506549273719292386803e-29L, }, - { 0.7888609052210118054117285652827862296732e-30L, 0.7888609052210118054117285652824750789093e-30L, 0.7888609052210118054117285652830973804371e-30L, }, - { -0.7888609052210118054117285652827862296732e-30L, -0.7888609052210118054117285652830973804371e-30L, -0.7888609052210118054117285652824750789093e-30L, }, - { 0.5578088954947358002532746368599573441654e-30L, 0.5578088954947358002532746368598017687835e-30L, 0.5578088954947358002532746368601129195474e-30L, }, - { -0.5578088954947358002532746368599573441654e-30L, -0.5578088954947358002532746368601129195474e-30L, -0.5578088954947358002532746368598017687835e-30L, }, - { 0.3944304526105059027058642826413931148366e-30L, 0.3944304526105059027058642826413153271456e-30L, 0.3944304526105059027058642826414709025276e-30L, }, - { -0.3944304526105059027058642826413931148366e-30L, -0.3944304526105059027058642826414709025276e-30L, -0.3944304526105059027058642826413153271456e-30L, }, - { 0.2789044477473679001266373184299786720827e-30L, 0.2789044477473679001266373184299397782372e-30L, 0.2789044477473679001266373184300175659282e-30L, }, - { -0.2789044477473679001266373184299786720827e-30L, -0.2789044477473679001266373184300175659282e-30L, -0.2789044477473679001266373184299397782372e-30L, }, - { 0.1972152263052529513529321413206965574183e-30L, 0.1972152263052529513529321413206771104956e-30L, 0.197215226305252951352932141320716004341e-30L, }, - { -0.1972152263052529513529321413206965574183e-30L, -0.197215226305252951352932141320716004341e-30L, -0.1972152263052529513529321413206771104956e-30L, }, - { 0.1394522238736839500633186592149893360414e-30L, 0.13945222387368395006331865921497961258e-30L, 0.1394522238736839500633186592149990595027e-30L, }, - { -0.1394522238736839500633186592149893360414e-30L, -0.1394522238736839500633186592149990595027e-30L, -0.13945222387368395006331865921497961258e-30L, }, - { 0.9860761315262647567646607066034827870915e-31L, 0.9860761315262647567646607066034341697846e-31L, 0.9860761315262647567646607066035314043984e-31L, }, - { -0.9860761315262647567646607066034827870915e-31L, -0.9860761315262647567646607066035314043984e-31L, -0.9860761315262647567646607066034341697846e-31L, }, - { 0.6972611193684197503165932960749466802068e-31L, 0.6972611193684197503165932960749223715534e-31L, 0.6972611193684197503165932960749709888602e-31L, }, - { -0.6972611193684197503165932960749466802068e-31L, -0.6972611193684197503165932960749709888602e-31L, -0.6972611193684197503165932960749223715534e-31L, }, - { 0.4930380657631323783823303533017413935458e-31L, 0.493038065763132378382330353301729239219e-31L, 0.4930380657631323783823303533017535478725e-31L, }, - { -0.4930380657631323783823303533017413935458e-31L, -0.4930380657631323783823303533017535478725e-31L, -0.493038065763132378382330353301729239219e-31L, }, - { 0.3486305596842098751582966480374733401034e-31L, 0.34863055968420987515829664803746726294e-31L, 0.3486305596842098751582966480374794172668e-31L, }, - { -0.3486305596842098751582966480374733401034e-31L, -0.3486305596842098751582966480374794172668e-31L, -0.34863055968420987515829664803746726294e-31L, }, - { 0.2465190328815661891911651766508706967729e-31L, 0.2465190328815661891911651766508676581912e-31L, 0.2465190328815661891911651766508737353546e-31L, }, - { -0.2465190328815661891911651766508706967729e-31L, -0.2465190328815661891911651766508737353546e-31L, -0.2465190328815661891911651766508676581912e-31L, }, - { 0.1743152798421049375791483240187366700517e-31L, 0.1743152798421049375791483240187351507609e-31L, 0.1743152798421049375791483240187381893425e-31L, }, - { -0.1743152798421049375791483240187366700517e-31L, -0.1743152798421049375791483240187381893425e-31L, -0.1743152798421049375791483240187351507609e-31L, }, - { 0.1232595164407830945955825883254353483864e-31L, 0.123259516440783094595582588325434588741e-31L, 0.1232595164407830945955825883254361080319e-31L, }, - { -0.1232595164407830945955825883254353483864e-31L, -0.1232595164407830945955825883254361080319e-31L, -0.123259516440783094595582588325434588741e-31L, }, - { 0.8715763992105246878957416200936833502585e-32L, 0.8715763992105246878957416200936795520314e-32L, 0.8715763992105246878957416200936871484856e-32L, }, - { -0.8715763992105246878957416200936833502585e-32L, -0.8715763992105246878957416200936871484856e-32L, -0.8715763992105246878957416200936795520314e-32L, }, - { 0.6162975822039154729779129416271767419322e-32L, 0.6162975822039154729779129416271748428186e-32L, 0.6162975822039154729779129416271786410457e-32L, }, - { -0.6162975822039154729779129416271767419322e-32L, -0.6162975822039154729779129416271786410457e-32L, -0.6162975822039154729779129416271748428186e-32L, }, - { 0.4357881996052623439478708100468416751293e-32L, 0.4357881996052623439478708100468407255725e-32L, 0.435788199605262343947870810046842624686e-32L, }, - { -0.4357881996052623439478708100468416751293e-32L, -0.435788199605262343947870810046842624686e-32L, -0.4357881996052623439478708100468407255725e-32L, }, - { 0.3081487911019577364889564708135883709661e-32L, 0.3081487911019577364889564708135878961877e-32L, 0.3081487911019577364889564708135888457445e-32L, }, - { -0.3081487911019577364889564708135883709661e-32L, -0.3081487911019577364889564708135888457445e-32L, -0.3081487911019577364889564708135878961877e-32L, }, - { 0.2178940998026311719739354050234208375646e-32L, 0.2178940998026311719739354050234206001754e-32L, 0.2178940998026311719739354050234210749538e-32L, }, - { -0.2178940998026311719739354050234208375646e-32L, -0.2178940998026311719739354050234210749538e-32L, -0.2178940998026311719739354050234206001754e-32L, }, - { 0.154074395550978868244478235406794185483e-32L, 0.1540743955509788682444782354067940667885e-32L, 0.1540743955509788682444782354067943041776e-32L, }, - { -0.154074395550978868244478235406794185483e-32L, -0.1540743955509788682444782354067943041776e-32L, -0.1540743955509788682444782354067940667885e-32L, }, - { 0.1089470499013155859869677025117104187823e-32L, 0.108947049901315585986967702511710359435e-32L, 0.1089470499013155859869677025117104781296e-32L, }, - { -0.1089470499013155859869677025117104187823e-32L, -0.1089470499013155859869677025117104781296e-32L, -0.108947049901315585986967702511710359435e-32L, }, - { 0.7703719777548943412223911770339709274152e-33L, 0.7703719777548943412223911770339706306787e-33L, 0.7703719777548943412223911770339712241517e-33L, }, - { -0.7703719777548943412223911770339709274152e-33L, -0.7703719777548943412223911770339712241517e-33L, -0.7703719777548943412223911770339706306787e-33L, }, - { 0.5447352495065779299348385125585520939116e-33L, 0.5447352495065779299348385125585519455433e-33L, 0.5447352495065779299348385125585522422798e-33L, }, - { -0.5447352495065779299348385125585520939116e-33L, -0.5447352495065779299348385125585522422798e-33L, -0.5447352495065779299348385125585519455433e-33L, }, - { 0.3851859888774471706111955885169854637076e-33L, 0.3851859888774471706111955885169853895235e-33L, 0.3851859888774471706111955885169855378917e-33L, }, - { -0.3851859888774471706111955885169854637076e-33L, -0.3851859888774471706111955885169855378917e-33L, -0.3851859888774471706111955885169853895235e-33L, }, - { 0.2723676247532889649674192562792760469558e-33L, 0.2723676247532889649674192562792760098637e-33L, 0.2723676247532889649674192562792760840478e-33L, }, - { -0.2723676247532889649674192562792760469558e-33L, -0.2723676247532889649674192562792760840478e-33L, -0.2723676247532889649674192562792760098637e-33L, }, - { 0.1925929944387235853055977942584927318538e-33L, 0.1925929944387235853055977942584927133078e-33L, 0.1925929944387235853055977942584927503998e-33L, }, - { -0.1925929944387235853055977942584927318538e-33L, -0.1925929944387235853055977942584927503998e-33L, -0.1925929944387235853055977942584927133078e-33L, }, - { 0.1361838123766444824837096281396380234779e-33L, 0.1361838123766444824837096281396380142049e-33L, 0.1361838123766444824837096281396380327509e-33L, }, - { -0.1361838123766444824837096281396380234779e-33L, -0.1361838123766444824837096281396380327509e-33L, -0.1361838123766444824837096281396380142049e-33L, }, - { 0.9629649721936179265279889712924636592691e-34L, 0.962964972193617926527988971292463612904e-34L, 0.9629649721936179265279889712924637056341e-34L, }, - { -0.9629649721936179265279889712924636592691e-34L, -0.9629649721936179265279889712924637056341e-34L, -0.962964972193617926527988971292463612904e-34L, }, - { 0.6809190618832224124185481406981901173895e-34L, 0.6809190618832224124185481406981900942069e-34L, 0.680919061883222412418548140698190140572e-34L, }, - { -0.6809190618832224124185481406981901173895e-34L, -0.680919061883222412418548140698190140572e-34L, -0.6809190618832224124185481406981900942069e-34L, }, - { 0.4814824860968089632639944856462318296345e-34L, 0.4814824860968089632639944856462318180433e-34L, 0.4814824860968089632639944856462318412258e-34L, }, - { -0.4814824860968089632639944856462318296345e-34L, -0.4814824860968089632639944856462318412258e-34L, -0.4814824860968089632639944856462318180433e-34L, }, - { 0.3404595309416112062092740703490950586947e-34L, 0.3404595309416112062092740703490950528991e-34L, 0.3404595309416112062092740703490950644904e-34L, }, - { -0.3404595309416112062092740703490950586947e-34L, -0.3404595309416112062092740703490950644904e-34L, -0.3404595309416112062092740703490950528991e-34L, }, - { 0.2407412430484044816319972428231159148173e-34L, 0.2407412430484044816319972428231159119194e-34L, 0.2407412430484044816319972428231159177151e-34L, }, - { -0.2407412430484044816319972428231159148173e-34L, -0.2407412430484044816319972428231159177151e-34L, -0.2407412430484044816319972428231159119194e-34L, }, - { 0.1702297654708056031046370351745475293474e-34L, 0.1702297654708056031046370351745475278985e-34L, 0.1702297654708056031046370351745475307963e-34L, }, - { -0.1702297654708056031046370351745475293474e-34L, -0.1702297654708056031046370351745475307963e-34L, -0.1702297654708056031046370351745475278985e-34L, }, - { 0.1203706215242022408159986214115579574086e-34L, 0.1203706215242022408159986214115579566842e-34L, 0.1203706215242022408159986214115579581331e-34L, }, - { -0.1203706215242022408159986214115579574086e-34L, -0.1203706215242022408159986214115579581331e-34L, -0.1203706215242022408159986214115579566842e-34L, }, - { 0.8511488273540280155231851758727376467368e-35L, 0.8511488273540280155231851758727376431146e-35L, 0.8511488273540280155231851758727376503591e-35L, }, - { -0.8511488273540280155231851758727376467368e-35L, -0.8511488273540280155231851758727376503591e-35L, -0.8511488273540280155231851758727376431146e-35L, }, - { 0.6018531076210112040799931070577897870432e-35L, 0.601853107621011204079993107057789785232e-35L, 0.6018531076210112040799931070577897888543e-35L, }, - { -0.6018531076210112040799931070577897870432e-35L, -0.6018531076210112040799931070577897888543e-35L, -0.601853107621011204079993107057789785232e-35L, }, - { 0.4255744136770140077615925879363688233684e-35L, 0.4255744136770140077615925879363688224628e-35L, 0.425574413677014007761592587936368824274e-35L, }, - { -0.4255744136770140077615925879363688233684e-35L, -0.425574413677014007761592587936368824274e-35L, -0.4255744136770140077615925879363688224628e-35L, }, - { 0.3009265538105056020399965535288948935216e-35L, 0.3009265538105056020399965535288948930688e-35L, 0.3009265538105056020399965535288948939744e-35L, }, - { -0.3009265538105056020399965535288948935216e-35L, -0.3009265538105056020399965535288948939744e-35L, -0.3009265538105056020399965535288948930688e-35L, }, - { 0.2127872068385070038807962939681844116842e-35L, 0.2127872068385070038807962939681844114578e-35L, 0.2127872068385070038807962939681844119106e-35L, }, - { -0.2127872068385070038807962939681844116842e-35L, -0.2127872068385070038807962939681844119106e-35L, -0.2127872068385070038807962939681844114578e-35L, }, - { 0.1504632769052528010199982767644474467608e-35L, 0.1504632769052528010199982767644474466476e-35L, 0.150463276905252801019998276764447446874e-35L, }, - { -0.1504632769052528010199982767644474467608e-35L, -0.150463276905252801019998276764447446874e-35L, -0.1504632769052528010199982767644474466476e-35L, }, - { 0.1063936034192535019403981469840922058421e-35L, 0.1063936034192535019403981469840922057855e-35L, 0.1063936034192535019403981469840922058987e-35L, }, - { -0.1063936034192535019403981469840922058421e-35L, -0.1063936034192535019403981469840922058987e-35L, -0.1063936034192535019403981469840922057855e-35L, }, - { 0.7523163845262640050999913838222372338039e-36L, 0.752316384526264005099991383822237233521e-36L, 0.7523163845262640050999913838222372340869e-36L, }, - { -0.7523163845262640050999913838222372338039e-36L, -0.7523163845262640050999913838222372340869e-36L, -0.752316384526264005099991383822237233521e-36L, }, - { 0.5319680170962675097019907349204610292105e-36L, 0.531968017096267509701990734920461029069e-36L, 0.531968017096267509701990734920461029352e-36L, }, - { -0.5319680170962675097019907349204610292105e-36L, -0.531968017096267509701990734920461029352e-36L, -0.531968017096267509701990734920461029069e-36L, }, - { 0.376158192263132002549995691911118616902e-36L, 0.3761581922631320025499956919111186168312e-36L, 0.3761581922631320025499956919111186169727e-36L, }, - { -0.376158192263132002549995691911118616902e-36L, -0.3761581922631320025499956919111186169727e-36L, -0.3761581922631320025499956919111186168312e-36L, }, - { 0.2659840085481337548509953674602305146053e-36L, 0.2659840085481337548509953674602305145699e-36L, 0.2659840085481337548509953674602305146406e-36L, }, - { -0.2659840085481337548509953674602305146053e-36L, -0.2659840085481337548509953674602305146406e-36L, -0.2659840085481337548509953674602305145699e-36L, }, - { 0.188079096131566001274997845955559308451e-36L, 0.1880790961315660012749978459555593084333e-36L, 0.1880790961315660012749978459555593084687e-36L, }, - { -0.188079096131566001274997845955559308451e-36L, -0.1880790961315660012749978459555593084687e-36L, -0.1880790961315660012749978459555593084333e-36L, }, - { 0.1329920042740668774254976837301152573026e-36L, 0.1329920042740668774254976837301152572938e-36L, 0.1329920042740668774254976837301152573115e-36L, }, - { -0.1329920042740668774254976837301152573026e-36L, -0.1329920042740668774254976837301152573115e-36L, -0.1329920042740668774254976837301152572938e-36L, }, - { 0.9403954806578300063749892297777965422549e-37L, 0.9403954806578300063749892297777965422107e-37L, 0.9403954806578300063749892297777965422991e-37L, }, - { -0.9403954806578300063749892297777965422549e-37L, -0.9403954806578300063749892297777965422991e-37L, -0.9403954806578300063749892297777965422107e-37L, }, - { 0.6649600213703343871274884186505762865131e-37L, 0.664960021370334387127488418650576286491e-37L, 0.6649600213703343871274884186505762865353e-37L, }, - { -0.6649600213703343871274884186505762865131e-37L, -0.6649600213703343871274884186505762865353e-37L, -0.664960021370334387127488418650576286491e-37L, }, - { 0.4701977403289150031874946148888982711275e-37L, 0.4701977403289150031874946148888982711164e-37L, 0.4701977403289150031874946148888982711385e-37L, }, - { -0.4701977403289150031874946148888982711275e-37L, -0.4701977403289150031874946148888982711385e-37L, -0.4701977403289150031874946148888982711164e-37L, }, - { 0.3324800106851671935637442093252881432566e-37L, 0.332480010685167193563744209325288143251e-37L, 0.3324800106851671935637442093252881432621e-37L, }, - { -0.3324800106851671935637442093252881432566e-37L, -0.3324800106851671935637442093252881432621e-37L, -0.332480010685167193563744209325288143251e-37L, }, - { 0.2350988701644575015937473074444491355637e-37L, 0.235098870164457501593747307444449135561e-37L, 0.2350988701644575015937473074444491355665e-37L, }, - { -0.2350988701644575015937473074444491355637e-37L, -0.2350988701644575015937473074444491355665e-37L, -0.235098870164457501593747307444449135561e-37L, }, - { 0.1662400053425835967818721046626440716283e-37L, 0.1662400053425835967818721046626440716269e-37L, 0.1662400053425835967818721046626440716297e-37L, }, - { -0.1662400053425835967818721046626440716283e-37L, -0.1662400053425835967818721046626440716297e-37L, -0.1662400053425835967818721046626440716269e-37L, }, - { 0.1175494350822287507968736537222245677819e-37L, 0.1175494350822287507968736537222245677812e-37L, 0.1175494350822287507968736537222245677826e-37L, }, - { -0.1175494350822287507968736537222245677819e-37L, -0.1175494350822287507968736537222245677826e-37L, -0.1175494350822287507968736537222245677812e-37L, }, - { 0.8312000267129179839093605233132203581414e-38L, 0.831200026712917983909360523313220358138e-38L, 0.8312000267129179839093605233132203581449e-38L, }, - { -0.8312000267129179839093605233132203581414e-38L, -0.8312000267129179839093605233132203581449e-38L, -0.831200026712917983909360523313220358138e-38L, }, - { 0.5877471754111437539843682686111228389093e-38L, 0.5877471754111437539843682686111228389076e-38L, 0.5877471754111437539843682686111228389111e-38L, }, - { -0.5877471754111437539843682686111228389093e-38L, -0.5877471754111437539843682686111228389111e-38L, -0.5877471754111437539843682686111228389076e-38L, }, - { 0.4156000133564589919546802616566101790707e-38L, 0.4156000133564589919546802616566101790699e-38L, 0.4156000133564589919546802616566101790716e-38L, }, - { -0.4156000133564589919546802616566101790707e-38L, -0.4156000133564589919546802616566101790716e-38L, -0.4156000133564589919546802616566101790699e-38L, }, - { 0.2938735877055718769921841343055614194547e-38L, 0.2938735877055718769921841343055614194542e-38L, 0.2938735877055718769921841343055614194551e-38L, }, - { -0.2938735877055718769921841343055614194547e-38L, -0.2938735877055718769921841343055614194551e-38L, -0.2938735877055718769921841343055614194542e-38L, }, -}; +// This file tests the functions log1p and expm1. The accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// + +void expected_results() +{ + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + + // + // Catch all cases come last: + // + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*", // test data group + ".*", // test function + 3, // Max Peek error + 2); // Max mean error + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; +} template -void test(T) +void do_test(const T& data, const char* type_name, const char* test_name) { - static const T two = 2; + typedef typename T::value_type row_type; + typedef typename row_type::value_type value_type; + + typedef value_type (*pg)(value_type); + pg funcp = boost::math::log1p; + + boost::math::tools::test_result result; + std::cout << "Testing " << test_name << " with type " << type_name + << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // - // Fudge factor is 3 epsilon, should be less than that, but some - // platforms have poor long double support (some of the test values - // actually test the accuracy of std::log and std::exp, and it's - // usually these, rather than our series expansion that fails otherwise). - // - static const T factor = std::pow(two, 1-std::numeric_limits::digits) * 300; - for(unsigned i = 0; i < sizeof(data)/sizeof(data[0]); ++i) - { - T input_value = static_cast(data[i][0]); - T expected_log1p = static_cast(data[i][1]); - T expected_expm1 = static_cast(data[i][2]); - BOOST_CHECK_CLOSE(boost::math::log1p(input_value), expected_log1p, factor); - BOOST_CHECK_CLOSE(boost::math::expm1(input_value), expected_expm1, factor); - BOOST_CHECK_CLOSE(boost::math::expm1(-input_value), -boost::math::expm1(input_value)/static_cast(std::exp(input_value)), 2*factor); - } + // test log1p against data: + // + funcp = boost::math::log1p; + result = boost::math::tools::test( + data, + boost::lambda::bind(funcp, + boost::lambda::ret(boost::lambda::_1[0])), + boost::lambda::ret(boost::lambda::_1[1])); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::log1p", "log1p and expm1"); + std::cout << std::endl; + // + // test expm1 against data: + // + funcp = boost::math::expm1; + result = boost::math::tools::test( + data, + boost::lambda::bind(funcp, + boost::lambda::ret(boost::lambda::_1[0])), + boost::lambda::ret(boost::lambda::_1[2])); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::expm1", "log1p and expm1"); + std::cout << std::endl; +} + +template +void test(T, const char* type_name) +{ +# include "log1p_expm1_data.ipp" + + do_test(log1p_expm1_data, type_name, "expm1 and log1p"); + // // C99 Appendix F special cases: static const T zero = 0; @@ -571,18 +123,17 @@ void test(T) int test_main(int, char* []) { - std::cout << "Running float tests" << std::endl; - test(float(0)); - std::cout << "Running double tests" << std::endl; - test(double(0)); + expected_results(); + test(float(0), "float"); + test(double(0), "double"); // // The long double version of these tests fails on some platforms // due to poor std lib support (not enough digits returned from // std::log and std::exp): // #if !defined(__CYGWIN__) && !defined(__FreeBSD__) && !(defined(__GNUC__) && defined(__sun)) - std::cout << "Running long double tests" << std::endl; - test((long double)(0)); + test((long double)(0), "long double"); + test((boost::math::concepts::real_concept)(0), "real_concept"); #else std::cout << "The long double tests have been disabled on this platform " "either because the long double overloads of the usual math functions are " diff --git a/test/powm1_sqrtp1m1_test.cpp b/test/powm1_sqrtp1m1_test.cpp index fd593288b..413cecdab 100644 --- a/test/powm1_sqrtp1m1_test.cpp +++ b/test/powm1_sqrtp1m1_test.cpp @@ -4,6 +4,8 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include +#include +#include #include #include #include @@ -11,8 +13,53 @@ #include #include +#include "handle_test_result.hpp" + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the functions powm1 and sqrtp1m1. +// The accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// + +void expected_results() +{ + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + ".*", // test data group + ".*", 3, 2); // test function + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; +} + template -void test_powm1_sqrtp1m1(T, const char* name) +void test_powm1_sqrtp1m1(T, const char* type_name) { #define SC_(x) static_cast(BOOST_JOIN(x, L)) static const boost::array, 141> sqrtp1m1_data = { @@ -1571,7 +1618,6 @@ void test_powm1_sqrtp1m1(T, const char* name) typedef T (*func_t)(const T&); func_t f = &boost::math::sqrtp1m1; - T eps = ldexp(T(1.0), 1-boost::math::tools::digits()); boost::math::tools::test_result result = boost::math::tools::test( sqrtp1m1_data, @@ -1579,8 +1625,8 @@ void test_powm1_sqrtp1m1(T, const char* name) ret(_1[1])); std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" - "Test results for type " << name << std::endl << std::endl; - std::cout << "sqrtp1m1 max error=" << ((result.stat.max)()/eps) << " at point " << sqrtp1m1_data[result.worst_case][0] << std::endl << std::endl; + "Test results for type " << type_name << std::endl << std::endl; + handle_test_result(result, sqrtp1m1_data[result.worst()], result.worst(), type_name, "boost::math::sqrtp1m1", "sqrtp1m1"); typedef T (*func2_t)(T, T); func2_t f2 = &boost::math::powm1; @@ -1588,15 +1634,23 @@ void test_powm1_sqrtp1m1(T, const char* name) powm1_data, bind(f2, ret(_1[0]), ret(_1[1])), ret(_1[2])); - std::cout << "powm1 max error=" << ((result.stat.max)()/eps) << " at point " << powm1_data[result.worst_case][0] << std::endl << std::endl; + handle_test_result(result, powm1_data[result.worst()], result.worst(), type_name, "boost::math::powm1", "powm1"); } -int main() +int test_main(int, char* []) { + expected_results(); test_powm1_sqrtp1m1(1.0F, "float"); test_powm1_sqrtp1m1(1.0, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_powm1_sqrtp1m1(1.0L, "long double"); test_powm1_sqrtp1m1(boost::math::concepts::real_concept(), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif return 0; } diff --git a/test/test_beta.cpp b/test/test_beta.cpp index 9e9d0ae24..bc59ebd6f 100644 --- a/test/test_beta.cpp +++ b/test/test_beta.cpp @@ -16,17 +16,86 @@ #include #include "test_beta_hooks.hpp" +#include "handle_test_result.hpp" +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the function beta. There are two sets of tests, spot +// tests which compare our results with selected values computed +// using the online special function calculator at +// functions.wolfram.com, while the bulk of the accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// -template -void print_test_result(const boost::math::tools::test_result& result, - T worst, const char* name, const char* test) +void expected_results() { - using namespace std; - T eps = pow(T(2), 1-boost::math::tools::digits()); - std::cout << setprecision(4); - std::cout << test << "(" << name << ") Max = " << (result.stat.max)()/eps - << " RMS Mean=" << result.stat.rms()/eps << " worst case at point: " << worst << std::endl; + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "(long\\s+)?double", // test type(s) + "Beta Function: Small.*", // test data group + "boost::math::beta", 8, 5); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "(long\\s+)?double", // test type(s) + "Beta Function: Medium.*", // test data group + "boost::math::beta", 101, 35); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "(long\\s+)?double", // test type(s) + "Beta Function: Divergent.*", // test data group + "boost::math::beta", 14, 6); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "Beta Function: Small.*", // test data group + "boost::math::beta", 10, 6); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "Beta Function: Medium.*", // test data group + "boost::math::beta", 60, 35); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "Beta Function: Divergent.*", // test data group + "boost::math::beta", 15, 8); // test function + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; } template @@ -52,7 +121,7 @@ void do_test_beta(const T& data, const char* type_name, const char* test_name) boost::lambda::ret(boost::lambda::_1[0]), boost::lambda::ret(boost::lambda::_1[1])), boost::lambda::ret(boost::lambda::_1[2])); - print_test_result(result, data[result.worst_case][0], type_name, "boost::math::beta"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::beta", test_name); #ifdef TEST_OTHER if(::boost::is_floating_point::value){ funcp = other::beta; @@ -62,7 +131,7 @@ void do_test_beta(const T& data, const char* type_name, const char* test_name) boost::lambda::ret(boost::lambda::_1[0]), boost::lambda::ret(boost::lambda::_1[1])), boost::lambda::ret(boost::lambda::_1[2])); - print_test_result(result, data[result.worst_case][0], type_name, "other::beta"); + print_test_result(result, data[result.worst()], result.worst(), type_name, "other::beta"); } #endif std::cout << std::endl; @@ -89,32 +158,50 @@ void test_beta(T, const char* name) do_test_beta(beta_exp_data, name, "Beta Function: Divergent Values"); } +#undef small // VC++ #defines small char !!!!!! template void test_spots(T) { // - // basic sanity checks, tolerance is 10 decimal places expressed as a percentage: + // basic sanity checks, tolerance is 10 epsilon expressed as a percentage: // - T tolerance = std::pow(10.0, -8); + T tolerance = boost::math::tools::epsilon() * 10 * 100; + T small = boost::math::tools::epsilon() / 1024; BOOST_CHECK_CLOSE(::boost::math::beta(static_cast(1), static_cast(1)), static_cast(1), tolerance); BOOST_CHECK_CLOSE(::boost::math::beta(static_cast(1), static_cast(4)), static_cast(0.25), tolerance); BOOST_CHECK_CLOSE(::boost::math::beta(static_cast(4), static_cast(1)), static_cast(0.25), tolerance); - BOOST_CHECK_CLOSE(::boost::math::beta(static_cast(1e-50), static_cast(4)), static_cast(1e50), tolerance); - BOOST_CHECK_CLOSE(::boost::math::beta(static_cast(4), static_cast(1e-50)), static_cast(1e50), tolerance); + BOOST_CHECK_CLOSE(::boost::math::beta(small, static_cast(4)), 1/small, tolerance); + BOOST_CHECK_CLOSE(::boost::math::beta(static_cast(4), small), 1/small, tolerance); BOOST_CHECK_CLOSE(::boost::math::beta(static_cast(4), static_cast(20)), static_cast(0.00002823263692828910220214568040654997176736L), tolerance); BOOST_CHECK_CLOSE(::boost::math::beta(static_cast(0.0125), static_cast(0.000023)), static_cast(43558.24045647538375006349016083320744662L), tolerance); } int test_main(int, char* []) { - //test_spots(0.0F); + expected_results(); + test_spots(0.0F); test_spots(0.0); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_spots(0.0L); test_spots(boost::math::concepts::real_concept(0.1)); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif + test_beta(0.1F, "float"); test_beta(0.1, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_beta(0.1L, "long double"); test_beta(boost::math::concepts::real_concept(0.1), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif return 0; } diff --git a/test/test_cbrt.cpp b/test/test_cbrt.cpp index 6b97533be..9f9ca401e 100644 --- a/test/test_cbrt.cpp +++ b/test/test_cbrt.cpp @@ -14,17 +14,44 @@ #include #include -template -void print_test_result(const boost::math::tools::test_result& result, - T worst, const char* name, const char* test) +#include "handle_test_result.hpp" + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the function cbrt. The accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// + +void expected_results() { - using namespace std; - T eps = pow(T(2), 1-boost::math::tools::digits()); - std::cout << setprecision(4); - std::cout << test << "(" << name << ") Max = " << (result.stat.max)()/eps - << " RMS Mean=" << result.stat.rms()/eps << " worst case at point: " << worst << std::endl; + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; } + template void do_test_cbrt(const T& data, const char* type_name, const char* test_name) { @@ -40,7 +67,7 @@ void do_test_cbrt(const T& data, const char* type_name, const char* test_name) << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; // - // test erf against data: + // test cbrt against data: // result = boost::math::tools::test( data, @@ -52,7 +79,7 @@ void do_test_cbrt(const T& data, const char* type_name, const char* test_name) boost::lambda::bind(funcp, -boost::lambda::ret(boost::lambda::_1[1])), -boost::lambda::ret(boost::lambda::_1[0])); - print_test_result(result, data[result.worst_case][1], type_name, "boost::math::cbrt"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::cbrt", test_name); std::cout << std::endl; } template diff --git a/test/test_erf.cpp b/test/test_erf.cpp index 00283faa8..29456db4f 100644 --- a/test/test_erf.cpp +++ b/test/test_erf.cpp @@ -7,8 +7,6 @@ #include #include #include -#include -#include #include #include #include @@ -16,17 +14,71 @@ #include #include "test_erf_hooks.hpp" +#include "handle_test_result.hpp" +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the functions erf, erfc, and the inverses +// erf_inv and erfc_inv. There are two sets of tests, spot +// tests which compare our results with selected values computed +// using the online special function calculator at +// functions.wolfram.com, while the bulk of the accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// -template -void print_test_result(const boost::math::tools::test_result& result, - T worst, const char* name, const char* test) +void expected_results() { - using namespace std; - T eps = pow(T(2), 1-boost::math::tools::digits()); - std::cout << setprecision(4); - std::cout << test << "(" << name << ") Max = " << (result.stat.max)()/eps - << " RMS Mean=" << result.stat.rms()/eps << " worst case at point: " << worst << std::endl; + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + add_expected_result( + "Microsoft.*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "Erf Function:.*", // test data group + "boost::math::erfc?", 4, 3); // test function + + + // + // Catch all cases come last: + // + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + "Erf Function:.*", // test data group + "boost::math::erfc?", 2, 2); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + "Inverse Erf.*", // test data group + "boost::math::erfc?_inv", 14, 4); // test function + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; } template @@ -51,7 +103,7 @@ void do_test_erf(const T& data, const char* type_name, const char* test_name) boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[1])); - print_test_result(result, data[result.worst_case][0], type_name, "boost::math::erf"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf", test_name); #ifdef TEST_OTHER if(::boost::is_floating_point::value){ funcp = other::erf; @@ -60,7 +112,7 @@ void do_test_erf(const T& data, const char* type_name, const char* test_name) boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[1])); - print_test_result(result, data[result.worst_case][0], type_name, "other::erf"); + print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erf"); } #endif // @@ -72,7 +124,7 @@ void do_test_erf(const T& data, const char* type_name, const char* test_name) boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[2])); - print_test_result(result, data[result.worst_case][0], type_name, "boost::math::erfc"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc", test_name); #ifdef TEST_OTHER if(::boost::is_floating_point::value){ funcp = other::erfc; @@ -81,7 +133,7 @@ void do_test_erf(const T& data, const char* type_name, const char* test_name) boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[2])); - print_test_result(result, data[result.worst_case][0], type_name, "other::erfc"); + print_test_result(result, data[result.worst()], result.worst(), type_name, "other::erfc"); } #endif std::cout << std::endl; @@ -108,7 +160,7 @@ void do_test_erf_inv(const T& data, const char* type_name, const char* test_name boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[1])); - print_test_result(result, data[result.worst_case][0], type_name, "boost::math::erf"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erf_inv", test_name); std::cout << std::endl; } @@ -133,7 +185,7 @@ void do_test_erfc_inv(const T& data, const char* type_name, const char* test_nam boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[1])); - print_test_result(result, data[result.worst_case][0], type_name, "boost::math::erfc_inv"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::erfc_inv", test_name); std::cout << std::endl; } @@ -176,20 +228,20 @@ void test_spots(T, const char* t) // basic sanity checks, tolerance is 10 epsilon expressed as a percentage: // T tolerance = boost::math::tools::epsilon() * 1000; - BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(0.125)), static_cast(0.859683795198666182606970553478), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(0.5)), static_cast(0.479500122186953462317253346108), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(1)), static_cast(0.157299207050285130658779364917), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(5)), static_cast(1.53745979442803485018834348538e-12), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(-0.125)), static_cast(1.14031620480133381739302944652), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(-0.5)), static_cast(1.52049987781304653768274665389), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(0.125)), static_cast(0.859683795198666182606970553478L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(0.5)), static_cast(0.479500122186953462317253346108L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(1)), static_cast(0.157299207050285130658779364917L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(5)), static_cast(1.53745979442803485018834348538e-12L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(-0.125)), static_cast(1.14031620480133381739302944652L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(-0.5)), static_cast(1.52049987781304653768274665389L), tolerance); BOOST_CHECK_CLOSE(::boost::math::erfc(static_cast(0)), static_cast(1), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(0.125)), static_cast(0.140316204801333817393029446522), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(0.5)), static_cast(0.520499877813046537682746653892), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(1)), static_cast(0.842700792949714869341220635083), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(5)), static_cast(0.99999999999846254020557196515), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(-0.125)), static_cast(-0.140316204801333817393029446522), tolerance); - BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(-0.5)), static_cast(-0.520499877813046537682746653892), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(0.125)), static_cast(0.140316204801333817393029446522L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(0.5)), static_cast(0.520499877813046537682746653892L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(1)), static_cast(0.842700792949714869341220635083L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(5)), static_cast(0.99999999999846254020557196515L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(-0.125)), static_cast(-0.140316204801333817393029446522L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(-0.5)), static_cast(-0.520499877813046537682746653892L), tolerance); BOOST_CHECK_CLOSE(::boost::math::erf(static_cast(0)), static_cast(0), tolerance); tolerance = boost::math::tools::epsilon() * 100 * 200; // 200 eps %. @@ -199,13 +251,13 @@ void test_spots(T, const char* t) tolerance = boost::math::tools::epsilon() * 100 * 200; // 200 eps %. #endif - for(T i = -0.95; i < 1; i += 0.125) + for(T i = -0.95f; i < 1; i += 0.125f) { T inv = boost::math::erf_inv(i); T b = boost::math::erf(inv); BOOST_CHECK_CLOSE(b, i, tolerance); } - for(T j = 0.125; j < 2; j += 0.125) + for(T j = 0.125f; j < 2; j += 0.125f) { T inv = boost::math::erfc_inv(j); T b = boost::math::erfc(inv); @@ -215,15 +267,26 @@ void test_spots(T, const char* t) int test_main(int, char* []) { - //test_spots(0.0F); + test_spots(0.0F, "float"); test_spots(0.0, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_spots(0.0L, "long double"); test_spots(boost::math::concepts::real_concept(0.1), "real_concept"); +#endif + + expected_results(); test_erf(0.1F, "float"); test_erf(0.1, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_erf(0.1L, "long double"); test_erf(boost::math::concepts::real_concept(0.1), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif return 0; } diff --git a/test/test_factorials.cpp b/test/test_factorials.cpp index 5edda25ea..6a63a6673 100644 --- a/test/test_factorials.cpp +++ b/test/test_factorials.cpp @@ -66,8 +66,15 @@ int test_main(int, char* []) { test_spots(0.0F); test_spots(0.0); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_spots(0.0L); test_spots(boost::math::concepts::real_concept(0.1)); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif return 0; } diff --git a/test/test_gamma.cpp b/test/test_gamma.cpp index 1561eee6c..2a9ebae1c 100644 --- a/test/test_gamma.cpp +++ b/test/test_gamma.cpp @@ -16,26 +16,141 @@ #include #include "test_gamma_hooks.hpp" +#include "handle_test_result.hpp" +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the functions tgamma and lgamma, and the +// function tgammap1m1. There are two sets of tests, spot +// tests which compare our results with selected values computed +// using the online special function calculator at +// functions.wolfram.com, while the bulk of the accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// -template -void print_test_result(const boost::math::tools::test_result& result, - const Seq& worst, int row, const char* name, const char* test) +void expected_results() { - using namespace std; - T eps = pow(T(2), 1-boost::math::tools::digits()); - std::cout << setprecision(4); - std::cout << test << "(" << name << ") Max = " << (result.stat.max)()/eps - << " RMS Mean =" << result.stat.rms()/eps - << "\n worst case at row: " - << row << "\n { "; - for(unsigned i = 0; i < worst.size(); ++i) + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + const char* largest_type; +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + if(boost::math::tools::digits() == boost::math::tools::digits()) { - if(i) - std::cout << ", "; - std::cout << worst[i]; + largest_type = "(long\\s+)?double"; } - std::cout << " }" << std::endl; + else + { + largest_type = "long double"; + } +#else + largest_type = "(long\\s+)?double"; +#endif + + + // + // Catch all cases come last: + // + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + largest_type, // test type(s) + "factorials", // test data group + "boost::math::tgamma", 4, 1); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + largest_type, // test type(s) + "factorials", // test data group + "boost::math::lgamma", 9, 1); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + largest_type, // test type(s) + "near (0|-55)", // test data group + "boost::math::(t|l)gamma", 5, 3); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + largest_type, // test type(s) + "near (1|2|-10)", // test data group + "boost::math::tgamma", 5, 3); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + largest_type, // test type(s) + "near (1|2|-10)", // test data group + "boost::math::lgamma", 14, 7); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + largest_type, // test type(s) + "tgammap1m1.*", // test data group + "boost::math::tgammap1m1", 30, 9); // test function + + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "factorials", // test data group + "boost::math::tgamma", 70, 25); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "factorials", // test data group + "boost::math::lgamma", 30, 4); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "near.*", // test data group + "boost::math::tgamma", 40, 20); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "near.*", // test data group + "boost::math::lgamma", 10000000, 10000000); // test function + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + "real_concept", // test type(s) + "tgammap1m1.*", // test data group + "boost::math::tgammap1m1", 20, 5); // test function + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; } template @@ -59,7 +174,7 @@ void do_test_gamma(const T& data, const char* type_name, const char* test_name) data, boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[1])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::tgamma"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name); #ifdef TEST_OTHER if(::boost::is_floating_point::value){ funcp = other::tgamma; @@ -67,7 +182,7 @@ void do_test_gamma(const T& data, const char* type_name, const char* test_name) data, boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[1])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "other::tgamma"); + print_test_result(result, data[result.worst()], result.worst(), type_name, "other::tgamma"); } #endif // @@ -78,7 +193,7 @@ void do_test_gamma(const T& data, const char* type_name, const char* test_name) data, boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[2])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::lgamma"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::lgamma", test_name); #ifdef TEST_OTHER if(::boost::is_floating_point::value){ funcp = other::lgamma; @@ -86,7 +201,7 @@ void do_test_gamma(const T& data, const char* type_name, const char* test_name) data, boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[2])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "other::lgamma"); + print_test_result(result, data[result.worst()], result.worst(), type_name, "other::lgamma"); } #endif @@ -114,183 +229,10 @@ void do_test_gammap1m1(const T& data, const char* type_name, const char* test_na data, boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0])), boost::lambda::ret(boost::lambda::_1[1])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::tgammap1m1"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgammap1m1", test_name); std::cout << std::endl; } -template -void do_test_gamma_2(const T& data, const char* type_name, const char* test_name) -{ - typedef typename T::value_type row_type; - typedef typename row_type::value_type value_type; - - typedef value_type (*pg)(value_type, value_type); - pg funcp = boost::math::tgamma; - - using namespace boost::lambda; - - boost::math::tools::test_result result; - - std::cout << "Testing " << test_name << " with type " << type_name - << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; - - // - // test tgamma(T, T) against data: - // - if(data[0][2] > 0) - { - result = boost::math::tools::test( - data, - bind(funcp, ret(_1[0]), ret(_1[1])), - ret(_1[2])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::tgamma"); - // - // test tgamma_lower(T, T) against data: - // - funcp = boost::math::tgamma_lower; - result = boost::math::tools::test( - data, - bind(funcp, ret(_1[0]), ret(_1[1])), - ret(_1[4])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::tgamma_lower"); - } - // - // test gamma_Q(T, T) against data: - // - funcp = boost::math::gamma_Q; - result = boost::math::tools::test( - data, - bind(funcp, ret(_1[0]), ret(_1[1])), - ret(_1[3])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::gamma_Q"); -#if defined(TEST_CEPHES) || defined(TEST_GSL) - // - // test other gamma_Q(T, T) against data: - // - if(boost::is_floating_point::value) - { - funcp = other::gamma_Q; - result = boost::math::tools::test( - data, - bind(funcp, ret(_1[0]), ret(_1[1])), - ret(_1[3])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "other::gamma_Q"); - } -#endif - // - // test gamma_P(T, T) against data: - // - funcp = boost::math::gamma_P; - result = boost::math::tools::test( - data, - bind(funcp, ret(_1[0]), ret(_1[1])), - ret(_1[5])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::gamma_P"); -#if defined(TEST_CEPHES) || defined(TEST_GSL) - // - // test other gamma_P(T, T) against data: - // - if(boost::is_floating_point::value) - { - funcp = other::gamma_P; - result = boost::math::tools::test( - data, - bind(funcp, ret(_1[0]), ret(_1[1])), - ret(_1[5])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "other::gamma_P"); - } -#endif - // - // test gamma_P_inv(T, T) against data: - // - using namespace std; - typedef typename T::value_type row_type; - typedef typename row_type::value_type value_type; - - value_type precision = static_cast(ldexp(1.0, 1-boost::math::tools::digits()/2)) * 100; - if(boost::math::tools::digits() < 50) - precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated - - for(unsigned i = 0; i < data.size(); ++i) - { - // - // These inverse tests are thrown off if the output of the - // incomplete gamma is too close to 1: basically there is insuffient - // information left in the value we're using as input to the inverse - // to be able to get back to the original value. - // - if(data[i][5] == 0) - BOOST_CHECK_EQUAL(boost::math::gamma_P_inv(data[i][0], data[i][5]), value_type(0)); - else if((1 - data[i][5] > 0.001) && (fabs(data[i][5]) >= boost::math::tools::min_value())) - { - value_type inv = boost::math::gamma_P_inv(data[i][0], data[i][5]); - BOOST_CHECK_CLOSE(data[i][1], inv, precision); - } - else if(1 == data[i][5]) - BOOST_CHECK_EQUAL(boost::math::gamma_P_inv(data[i][0], data[i][5]), boost::math::tools::max_value()); - else - { - // not enough bits in our input to get back to x, but we should be in - // the same ball park: - value_type inv = boost::math::gamma_P_inv(data[i][0], data[i][5]); - BOOST_CHECK_CLOSE(data[i][1], inv, 100000); - } - - if(data[i][3] == 0) - BOOST_CHECK_EQUAL(boost::math::gamma_Q_inv(data[i][0], data[i][3]), boost::math::tools::max_value()); - else if((1 - data[i][3] > 0.001) && (fabs(data[i][3]) >= boost::math::tools::min_value())) - { - value_type inv = boost::math::gamma_Q_inv(data[i][0], data[i][3]); - BOOST_CHECK_CLOSE(data[i][1], inv, precision); - } - else if(1 == data[i][3]) - BOOST_CHECK_EQUAL(boost::math::gamma_Q_inv(data[i][0], data[i][3]), value_type(0)); - else - { - // not enough bits in our input to get back to x, but we should be in - // the same ball park: - value_type inv = boost::math::gamma_Q_inv(data[i][0], data[i][3]); - BOOST_CHECK_CLOSE(data[i][1], inv, 100); - } - } - std::cout << std::endl; -} - -template -void do_test_gamma_inv(const T& data, const char* type_name, const char* test_name) -{ - typedef typename T::value_type row_type; - typedef typename row_type::value_type value_type; - - typedef value_type (*pg)(value_type, value_type); - pg funcp = boost::math::gamma_P_inv; - - using namespace boost::lambda; - - boost::math::tools::test_result result; - - std::cout << "Testing " << test_name << " with type " << type_name - << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; - - // - // test gamma_P_inv(T, T) against data: - // - result = boost::math::tools::test( - data, - bind(funcp, ret(_1[0]), ret(_1[1])), - ret(_1[2])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::gamma_P_inv"); - // - // test gamma_Q_inv(T, T) against data: - // - funcp = boost::math::gamma_Q_inv; - result = boost::math::tools::test( - data, - bind(funcp, ret(_1[0]), ret(_1[1])), - ret(_1[3])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::gamma_Q_inv"); -} - template void test_gamma(T, const char* name) { @@ -337,46 +279,15 @@ void test_gamma(T, const char* name) // And now tgammap1m1 which computes gamma(1+dz)-1: // do_test_gammap1m1(gammap1m1_data, name, "tgammap1m1(dz)"); - - // - // Now the data for the incomplete gamma function, each - // row has the following entries: - // Parameter a, parameter z, - // Expected tgamma(a, z), Expected gamma_Q(a, z) - // Expected tgamma_lower(a, z), Expected gamma_P(a, z) - // -# include "igamma_med_data.ipp" - - do_test_gamma_2(igamma_med_data, name, "tgamma(a, z) medium values"); - -# include "igamma_small_data.ipp" - - do_test_gamma_2(igamma_small_data, name, "tgamma(a, z) small values"); - -# include "igamma_big_data.ipp" - - do_test_gamma_2(igamma_big_data, name, "tgamma(a, z) large values"); - -# include "gamma_inv_data.ipp" - - do_test_gamma_inv(gamma_inv_data, name, "incomplete gamma inverse(a, z) medium values"); - -# include "gamma_inv_big_data.ipp" - - do_test_gamma_inv(gamma_inv_big_data, name, "incomplete gamma inverse(a, z) large values"); - -# include "gamma_inv_small_data.ipp" - - do_test_gamma_inv(gamma_inv_small_data, name, "incomplete gamma inverse(a, z) small values"); } template void test_spots(T) { // - // basic sanity checks, tolerance is 10 epsilon expressed as a percentage: + // basic sanity checks, tolerance is 50 epsilon expressed as a percentage: // - T tolerance = boost::math::tools::epsilon() * 1000; + T tolerance = boost::math::tools::epsilon() * 5000; BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(3.5)), static_cast(3.3233509704478425511840640312646472177454052302295L), tolerance); BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.125)), static_cast(7.5339415987976119046992298412151336246104195881491L), tolerance); BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(-0.125)), static_cast(-8.7172188593831756100190140408231437691829605421405L), tolerance); @@ -394,47 +305,30 @@ void test_spots(T) BOOST_CHECK(sign == 1); BOOST_CHECK_CLOSE(::boost::math::lgamma(static_cast(-53249.0/1024), &sign), static_cast(-149.43323093420259741100038126078721302600128285894L), tolerance); BOOST_CHECK(sign == -1); - - BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(5), static_cast(1)), static_cast(23.912163676143750903709045060494956383977723517065L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(5), static_cast(5)), static_cast(10.571838841565097874621959975919877646444998907920L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(5), static_cast(10)), static_cast(0.70206451384706574414638719662835463671916532623256L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(5), static_cast(100)), static_cast(3.8734332808745531496973774140085644548465762343719e-36L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.5), static_cast(0.5)), static_cast(0.56241823159440712427949495730204306902676756479651L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.5), static_cast(0.9)), static_cast(0.31853210360412109873859360390443790076576777747449L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.5), static_cast(5)), static_cast(0.0027746032604128093194908357272603294120210079791437L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.5), static_cast(100)), static_cast(3.7017478604082789202535664481339075721362102520338e-45L), tolerance); - - BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast(5), static_cast(1)), static_cast(0.087836323856249096290954939505043616022276482935091L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast(5), static_cast(5)), static_cast(13.428161158434902125378040024080122353555001092080L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast(5), static_cast(10)), static_cast(23.297935486152934255853612803371645363280834673767L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast(5), static_cast(100)), static_cast(23.999999999999999999999999999999999996126566719125L), tolerance); - - BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(5), static_cast(1)), static_cast(0.99634015317265628765454354418728984933240514654437L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(5), static_cast(5)), static_cast(0.44049328506521241144258166566332823526854162116334L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(5), static_cast(10)), static_cast(0.029252688076961072672766133192848109863298555259690L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(5), static_cast(100)), static_cast(1.6139305336977304790405739225035685228527400976549e-37L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(1.5), static_cast(2)), static_cast(0.26146412994911062220282207597592120190281060919079L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(20.5), static_cast(22)), static_cast(0.34575332043467326814971590879658406632570278929072L), tolerance); - - BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(5), static_cast(1)), static_cast(0.0036598468273437123454564558127101506675948534556288L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(5), static_cast(5)), static_cast(0.55950671493478758855741833433667176473145837883666L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(5), static_cast(10)), static_cast(0.97074731192303892732723386680715189013670144474031L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(5), static_cast(100)), static_cast(0.9999999999999999999999999999999999998386069466302L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(1.5), static_cast(2)), static_cast(0.73853587005088937779717792402407879809718939080921L), tolerance); - BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(20.5), static_cast(22)), static_cast(0.65424667956532673185028409120341593367429721070928L), tolerance); } int test_main(int, char* []) { + expected_results(); + test_spots(0.0F); test_spots(0.0); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_spots(0.0L); test_spots(boost::math::concepts::real_concept(0.1)); +#endif test_gamma(0.1F, "float"); test_gamma(0.1, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_gamma(0.1L, "long double"); test_gamma(boost::math::concepts::real_concept(0.1), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif return 0; } diff --git a/test/test_ibeta.cpp b/test/test_ibeta.cpp index da3468a1e..75ddec8d4 100644 --- a/test/test_ibeta.cpp +++ b/test/test_ibeta.cpp @@ -16,31 +16,105 @@ #include #include "test_beta_hooks.hpp" +#include "handle_test_result.hpp" -template -void print_test_result(const boost::math::tools::test_result& result, - const Seq& worst, int row, const char* name, const char* test) +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the incomplete beta functions beta, +// betac, ibeta and ibetac. There are two sets of tests, spot +// tests which compare our results with selected values computed +// using the online special function calculator at +// functions.wolfram.com, while the bulk of the accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// + +void expected_results() { - using namespace std; // To aid selection of the right pow. - T eps = pow(T(2), 1-boost::math::tools::digits()); - std::cout << std::setprecision(4); - std::cout << test << "(" << name << ") Max = " << (result.stat.max)()/eps - << " RMS Mean=" << result.stat.rms()/eps; - if((result.stat.max)() != 0) + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + const char* largest_type; +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + if(boost::math::tools::digits() == boost::math::tools::digits()) { - std::cout << "\n worst case at row: " - << row << "\n { "; - for(unsigned i = 0; i < worst.size(); ++i) - { - if(i) - std::cout << ", "; - std::cout << worst[i]; - } - std::cout << " }"; + largest_type = "(long\\s+)?double"; } - std::cout << std::endl; -} + else + { + largest_type = "long double"; + } +#else + largest_type = "(long\\s+)?double"; +#endif + // + // Catch all cases come last: + // + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "(?i).*small.*", // test data group + ".*", 20, 10); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "(?i).*medium.*", // test data group + ".*", 150, 50); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "(?i).*large.*", // test data group + ".*", 5000, 500); // test function + + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "(?i).*small.*", // test data group + ".*", 30, 15); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "(?i).*medium.*", // test data group + ".*", 100, 50); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "(?i).*large.*", // test data group + ".*", 200000, 50000); // test function + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; +} template void do_test_beta(const T& data, const char* type_name, const char* test_name) @@ -66,7 +140,7 @@ void do_test_beta(const T& data, const char* type_name, const char* test_name) boost::lambda::ret(boost::lambda::_1[1]), boost::lambda::ret(boost::lambda::_1[2])), boost::lambda::ret(boost::lambda::_1[3])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::beta"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::beta", test_name); funcp = boost::math::betac; result = boost::math::tools::test( @@ -76,7 +150,7 @@ void do_test_beta(const T& data, const char* type_name, const char* test_name) boost::lambda::ret(boost::lambda::_1[1]), boost::lambda::ret(boost::lambda::_1[2])), boost::lambda::ret(boost::lambda::_1[4])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::betac"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::betac", test_name); funcp = boost::math::ibeta; result = boost::math::tools::test( @@ -86,7 +160,7 @@ void do_test_beta(const T& data, const char* type_name, const char* test_name) boost::lambda::ret(boost::lambda::_1[1]), boost::lambda::ret(boost::lambda::_1[2])), boost::lambda::ret(boost::lambda::_1[5])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::ibeta"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibeta", test_name); funcp = boost::math::ibetac; result = boost::math::tools::test( @@ -96,7 +170,7 @@ void do_test_beta(const T& data, const char* type_name, const char* test_name) boost::lambda::ret(boost::lambda::_1[1]), boost::lambda::ret(boost::lambda::_1[2])), boost::lambda::ret(boost::lambda::_1[6])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::ibetac"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::ibetac", test_name); #ifdef TEST_OTHER if(::boost::is_floating_point::value){ funcp = other::ibeta; @@ -107,53 +181,12 @@ void do_test_beta(const T& data, const char* type_name, const char* test_name) boost::lambda::ret(boost::lambda::_1[1]), boost::lambda::ret(boost::lambda::_1[2])), boost::lambda::ret(boost::lambda::_1[5])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "other::ibeta"); + print_test_result(result, data[result.worst()], result.worst(), type_name, "other::ibeta"); } #endif std::cout << std::endl; } -template -void test_inverses(const T& data) -{ - using namespace std; - typedef typename T::value_type row_type; - typedef typename row_type::value_type value_type; - - value_type precision = static_cast(ldexp(1.0, 1-boost::math::tools::digits()/2)) * 100; - if(boost::math::tools::digits() < 50) - precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated - - for(unsigned i = 0; i < data.size(); ++i) - { - // - // These inverse tests are thrown off if the output of the - // incomplete beta is too close to 1: basically there is insuffient - // information left in the value we're using as input to the inverse - // to be able to get back to the original value. - // - if(data[i][5] == 0) - BOOST_CHECK_EQUAL(boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]), value_type(0)); - else if((1 - data[i][5] > 0.001) && (fabs(data[i][5]) >= boost::math::tools::min_value())) - { - value_type inv = boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]); - BOOST_CHECK_CLOSE(data[i][2], inv, precision); - } - else if(1 == data[i][5]) - BOOST_CHECK_EQUAL(boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]), value_type(1)); - - if(data[i][6] == 0) - BOOST_CHECK_EQUAL(boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]), value_type(1)); - else if((1 - data[i][6] > 0.001) && (fabs(data[i][6]) >= boost::math::tools::min_value())) - { - value_type inv = boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]); - BOOST_CHECK_CLOSE(data[i][2], inv, precision); - } - else if(data[i][6] == 1) - BOOST_CHECK_EQUAL(boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]), value_type(0)); - } -} - template void test_beta(T, const char* name) { @@ -166,93 +199,89 @@ void test_beta(T, const char* name) # include "ibeta_small_data.ipp" do_test_beta(ibeta_small_data, name, "Incomplete Beta Function: Small Values"); - test_inverses(ibeta_small_data); # include "ibeta_data.ipp" do_test_beta(ibeta_data, name, "Incomplete Beta Function: Medium Values"); - test_inverses(ibeta_data); # include "ibeta_large_data.ipp" do_test_beta(ibeta_large_data, name, "Incomplete Beta Function: Large and Diverse Values"); - test_inverses(ibeta_large_data); } template void test_spots(T) { // - // basic sanity checks, tolerance is 10 decimal places expressed as a percentage, - // One check per domain of the implementation: + // basic sanity checks, tolerance is 10 epsilon expressed as a percentage: // - T tolerance = std::pow(10.0, -8); + T tolerance = boost::math::tools::epsilon() * 1000; BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(0.015964560210704803), static_cast(1.1846856068586931e-005), static_cast(0.69176378846168518)), - static_cast(0.0007508604820642986204162462167319506309750), tolerance); + static_cast(0.0007508604820642986204162462167319506309750L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(42.434902191162109), static_cast(0.30012050271034241), static_cast(0.91574394702911377)), - static_cast(0.002844243156314242058287766324242276991912), tolerance); + static_cast(0.002844243156314242058287766324242276991912L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(9.7131776809692383), static_cast(99.406852722167969), static_cast(0.083912998437881470)), - static_cast(0.4612716118626361034813232775095335302198), tolerance); + static_cast(0.4612716118626361034813232775095335302198L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( - static_cast(72.695472717285156), - static_cast(1.1902070045471191), - static_cast(0.80036874115467072)), - static_cast(1.703685144285803673344984949797496197040e-7), tolerance); + static_cast(72.5), + static_cast(1.125), + static_cast(0.75)), + static_cast(1.3423066982487051710597194786268004978931316494920e-9L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(4.9854421615600586), static_cast(1.0665277242660522), static_cast(0.75997146964073181)), - static_cast(0.2755954254731642667260071858810487404614), tolerance); + static_cast(0.2755954254731642667260071858810487404614L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(6.8127136230468750), static_cast(1.0562920570373535), static_cast(0.17416560649871826)), - static_cast(7.702362015088558153029455563361002570531e-6), tolerance); + static_cast(7.702362015088558153029455563361002570531e-6L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(0.48983201384544373), static_cast(0.22512593865394592), static_cast(0.20032680034637451)), - static_cast(0.170905142698145967653807992508983970176), tolerance); + static_cast(0.170905142698145967653807992508983970176L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(4.0498137474060059), static_cast(0.15403440594673157), static_cast(0.65370121598243713)), - static_cast(0.0172702040689452906446803217247250156007), tolerance); + static_cast(0.0172702040689452906446803217247250156007L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(7.2695474624633789), static_cast(0.11902070045471191), static_cast(0.80036874115467072)), - static_cast(0.013346136714187857821168127038816508028), tolerance); + static_cast(0.013346136714187857821168127038816508028L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(2.7266697883605957), static_cast(0.011510574258863926), static_cast(0.086654007434844971)), - static_cast(5.812020420972734916187451486321162137375e-6), tolerance); + static_cast(5.812020420972734916187451486321162137375e-6L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(0.34317314624786377), static_cast(0.046342257410287857), static_cast(0.75823287665843964)), - static_cast(0.151317265120184850887504097401768195067), tolerance); + static_cast(0.151317265120184850887504097401768195067L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( @@ -283,29 +312,39 @@ void test_spots(T) static_cast(1), static_cast(0.046342257410287857), static_cast(0.32)), - static_cast(0.0177137046180187568703202426065033413304), tolerance); + static_cast(0.0177137046180187568703202426065033413304L), tolerance); BOOST_CHECK_CLOSE( ::boost::math::ibeta( static_cast(0.046342257410287857), static_cast(1), static_cast(0.32)), - static_cast(0.948565954109602496577407403168592262389), tolerance); + static_cast(0.948565954109602496577407403168592262389L), tolerance); } int test_main(int, char* []) { + expected_results(); #ifdef TEST_GSL gsl_set_error_handler_off(); #endif - //test_spots(0.0F); + test_spots(0.0F); test_spots(0.0); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_spots(0.0L); test_spots(boost::math::concepts::real_concept(0.1)); +#endif test_beta(0.1F, "float"); test_beta(0.1, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_beta(0.1L, "long double"); test_beta(boost::math::concepts::real_concept(0.1), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif return 0; } diff --git a/test/test_ibeta_inv.cpp b/test/test_ibeta_inv.cpp new file mode 100644 index 000000000..134ac8c05 --- /dev/null +++ b/test/test_ibeta_inv.cpp @@ -0,0 +1,182 @@ +// (C) Copyright John Maddock 2006. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "test_beta_hooks.hpp" +#include "handle_test_result.hpp" + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the incomplete beta function inverses +// ibeta_inv and ibetac_inv. There are three sets of tests: +// 1) Spot tests which compare our results with selected values +// computed using the online special function calculator at +// functions.wolfram.com, +// 2) TODO!!!! Accuracy tests use values generated with NTL::RR at +// 1000-bit precision and our generic versions of these functions. +// 3) Round trip sanity checks, use the test data for the forward +// functions, and verify that we can get (approximately) back +// where we started. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// + +void expected_results() +{ + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + + // + // Catch all cases come last: + // + // TODO!!!! + add_expected_result( + ".*", // compiler + ".*", // stdlib + ".*", // platform + ".*", // test type(s) + "Inverse Erf.*", // test data group + "boost::math::erfc?_inv", 14, 4); // test function + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; +} + +template +template +void test_inverses(const T& data) +{ + using namespace std; + typedef typename T::value_type row_type; + typedef typename row_type::value_type value_type; + + value_type precision = static_cast(ldexp(1.0, 1-boost::math::tools::digits()/2)) * 100; + if(boost::math::tools::digits() < 50) + precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated + + for(unsigned i = 0; i < data.size(); ++i) + { + // + // These inverse tests are thrown off if the output of the + // incomplete beta is too close to 1: basically there is insuffient + // information left in the value we're using as input to the inverse + // to be able to get back to the original value. + // + if(data[i][5] == 0) + BOOST_CHECK_EQUAL(boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]), value_type(0)); + else if((1 - data[i][5] > 0.001) && (fabs(data[i][5]) >= boost::math::tools::min_value())) + { + value_type inv = boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]); + BOOST_CHECK_CLOSE(data[i][2], inv, precision); + } + else if(1 == data[i][5]) + BOOST_CHECK_EQUAL(boost::math::ibeta_inv(data[i][0], data[i][1], data[i][5]), value_type(1)); + + if(data[i][6] == 0) + BOOST_CHECK_EQUAL(boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]), value_type(1)); + else if((1 - data[i][6] > 0.001) && (fabs(data[i][6]) >= boost::math::tools::min_value())) + { + value_type inv = boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]); + BOOST_CHECK_CLOSE(data[i][2], inv, precision); + } + else if(data[i][6] == 1) + BOOST_CHECK_EQUAL(boost::math::ibetac_inv(data[i][0], data[i][1], data[i][6]), value_type(0)); + } +} + +template +void test_beta(T, const char* name) +{ + // + // The actual test data is rather verbose, so it's in a separate file + // + // The contents are as follows, each row of data contains + // five items, input value a, input value b, integration limits x, beta(a, b, x) and ibeta(a, b, x): + // +# include "ibeta_small_data.ipp" + + test_inverses(ibeta_small_data); + +# include "ibeta_data.ipp" + + test_inverses(ibeta_data); + +# include "ibeta_large_data.ipp" + + test_inverses(ibeta_large_data); +} + +template +void test_spots(T) +{ + // + // basic sanity checks, tolerance is 10 epsilon expressed as a percentage: + // + T tolerance = boost::math::tools::epsilon() * 1000; + BOOST_CHECK_CLOSE( + ::boost::math::ibeta( + static_cast(0.015964560210704803), + static_cast(1.1846856068586931e-005), + static_cast(0.69176378846168518)), + static_cast(0.0007508604820642986204162462167319506309750), tolerance); +} + +int test_main(int, char* []) +{ + expected_results(); +#ifdef TEST_GSL + gsl_set_error_handler_off(); +#endif + test_spots(0.0F); + test_spots(0.0); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + test_spots(0.0L); + test_spots(boost::math::concepts::real_concept(0.1)); +#endif + + test_beta(0.1F, "float"); + test_beta(0.1, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + test_beta(0.1L, "long double"); + test_beta(boost::math::concepts::real_concept(0.1), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif + return 0; +} + + + diff --git a/test/test_igamma.cpp b/test/test_igamma.cpp new file mode 100644 index 000000000..0632b9b8c --- /dev/null +++ b/test/test_igamma.cpp @@ -0,0 +1,305 @@ +// (C) Copyright John Maddock 2006. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "test_gamma_hooks.hpp" +#include "handle_test_result.hpp" + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the incomplete gamma functions tgamma, +// tgamma_lower, gamma_P and gamma_Q. There are two sets of tests, spot +// tests which compare our results with selected values computed +// using the online special function calculator at +// functions.wolfram.com, while the bulk of the accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// + +void expected_results() +{ + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + const char* largest_type; +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + if(boost::math::tools::digits() == boost::math::tools::digits()) + { + largest_type = "(long\\s+)?double"; + } + else + { + largest_type = "long double"; + } +#else + largest_type = "(long\\s+)?double"; +#endif + + + // + // Catch all cases come last: + // + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*medium[^|]*", // test data group + "[^|]*", 50, 20); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*small[^|]*", // test data group + "[^|]*", 10, 5); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*large[^|]*", // test data group + "boost::math::gamma_Q", 500, 50); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "Cygwin", // platform + largest_type, // test type(s) + "[^|]*large[^|]*", // test data group + "boost::math::gamma_P", 700, 50); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*large[^|]*", // test data group + "boost::math::gamma_P", 300, 50); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "[^|]*medium[^|]*", // test data group + "[^|]*", 200, 50); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "[^|]*small[^|]*", // test data group + ".*", 10, 5); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "[^|]*large[^|]*", // test data group + ".*", 1000000, 100000); // test function + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; +} + +template +void do_test_gamma_2(const T& data, const char* type_name, const char* test_name) +{ + typedef typename T::value_type row_type; + typedef typename row_type::value_type value_type; + + typedef value_type (*pg)(value_type, value_type); + pg funcp = boost::math::tgamma; + + using namespace boost::lambda; + + boost::math::tools::test_result result; + + std::cout << "Testing " << test_name << " with type " << type_name + << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; + + // + // test tgamma(T, T) against data: + // + if(data[0][2] > 0) + { + result = boost::math::tools::test( + data, + bind(funcp, ret(_1[0]), ret(_1[1])), + ret(_1[2])); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma", test_name); + // + // test tgamma_lower(T, T) against data: + // + funcp = boost::math::tgamma_lower; + result = boost::math::tools::test( + data, + bind(funcp, ret(_1[0]), ret(_1[1])), + ret(_1[4])); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_lower", test_name); + } + // + // test gamma_Q(T, T) against data: + // + funcp = boost::math::gamma_Q; + result = boost::math::tools::test( + data, + bind(funcp, ret(_1[0]), ret(_1[1])), + ret(_1[3])); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_Q", test_name); +#if defined(TEST_CEPHES) || defined(TEST_GSL) + // + // test other gamma_Q(T, T) against data: + // + if(boost::is_floating_point::value) + { + funcp = other::gamma_Q; + result = boost::math::tools::test( + data, + bind(funcp, ret(_1[0]), ret(_1[1])), + ret(_1[3])); + print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_Q"); + } +#endif + // + // test gamma_P(T, T) against data: + // + funcp = boost::math::gamma_P; + result = boost::math::tools::test( + data, + bind(funcp, ret(_1[0]), ret(_1[1])), + ret(_1[5])); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_P", test_name); +#if defined(TEST_CEPHES) || defined(TEST_GSL) + // + // test other gamma_P(T, T) against data: + // + if(boost::is_floating_point::value) + { + funcp = other::gamma_P; + result = boost::math::tools::test( + data, + bind(funcp, ret(_1[0]), ret(_1[1])), + ret(_1[5])); + print_test_result(result, data[result.worst()], result.worst(), type_name, "other::gamma_P"); + } +#endif + std::cout << std::endl; +} + +template +void test_gamma(T, const char* name) +{ + // + // The actual test data is rather verbose, so it's in a separate file + // + // First the data for the incomplete gamma function, each + // row has the following 6 entries: + // Parameter a, parameter z, + // Expected tgamma(a, z), Expected gamma_Q(a, z) + // Expected tgamma_lower(a, z), Expected gamma_P(a, z) + // +# include "igamma_med_data.ipp" + + do_test_gamma_2(igamma_med_data, name, "tgamma(a, z) medium values"); + +# include "igamma_small_data.ipp" + + do_test_gamma_2(igamma_small_data, name, "tgamma(a, z) small values"); + +# include "igamma_big_data.ipp" + + do_test_gamma_2(igamma_big_data, name, "tgamma(a, z) large values"); +} + +template +void test_spots(T) +{ + // + // basic sanity checks, tolerance is 10 epsilon expressed as a percentage: + // + T tolerance = boost::math::tools::epsilon() * 1000; + BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(5), static_cast(1)), static_cast(23.912163676143750903709045060494956383977723517065L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(5), static_cast(5)), static_cast(10.571838841565097874621959975919877646444998907920L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(5), static_cast(10)), static_cast(0.70206451384706574414638719662835463671916532623256L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(5), static_cast(100)), static_cast(3.8734332808745531496973774140085644548465762343719e-36L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.5), static_cast(0.5)), static_cast(0.56241823159440712427949495730204306902676756479651L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.5), static_cast(0.9)), static_cast(0.31853210360412109873859360390443790076576777747449L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.5), static_cast(5)), static_cast(0.0027746032604128093194908357272603294120210079791437L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma(static_cast(0.5), static_cast(100)), static_cast(3.7017478604082789202535664481339075721362102520338e-45L), tolerance); + + BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast(5), static_cast(1)), static_cast(0.087836323856249096290954939505043616022276482935091L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast(5), static_cast(5)), static_cast(13.428161158434902125378040024080122353555001092080L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast(5), static_cast(10)), static_cast(23.297935486152934255853612803371645363280834673767L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::tgamma_lower(static_cast(5), static_cast(100)), static_cast(23.999999999999999999999999999999999996126566719125L), tolerance); + + BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(5), static_cast(1)), static_cast(0.99634015317265628765454354418728984933240514654437L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(5), static_cast(5)), static_cast(0.44049328506521241144258166566332823526854162116334L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(5), static_cast(10)), static_cast(0.029252688076961072672766133192848109863298555259690L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(5), static_cast(100)), static_cast(1.6139305336977304790405739225035685228527400976549e-37L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(1.5), static_cast(2)), static_cast(0.26146412994911062220282207597592120190281060919079L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q(static_cast(20.5), static_cast(22)), static_cast(0.34575332043467326814971590879658406632570278929072L), tolerance); + + BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(5), static_cast(1)), static_cast(0.0036598468273437123454564558127101506675948534556288L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(5), static_cast(5)), static_cast(0.55950671493478758855741833433667176473145837883666L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(5), static_cast(10)), static_cast(0.97074731192303892732723386680715189013670144474031L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(5), static_cast(100)), static_cast(0.9999999999999999999999999999999999998386069466302L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(1.5), static_cast(2)), static_cast(0.73853587005088937779717792402407879809718939080921L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_P(static_cast(20.5), static_cast(22)), static_cast(0.65424667956532673185028409120341593367429721070928L), tolerance); +} + +int test_main(int, char* []) +{ + expected_results(); + + test_spots(0.0F); + test_spots(0.0); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + test_spots(0.0L); + test_spots(boost::math::concepts::real_concept(0.1)); +#endif + + test_gamma(0.1F, "float"); + test_gamma(0.1, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + test_gamma(0.1L, "long double"); + test_gamma(boost::math::concepts::real_concept(0.1), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif + return 0; +} + + diff --git a/test/test_igamma_inv.cpp b/test/test_igamma_inv.cpp new file mode 100644 index 000000000..3470a7025 --- /dev/null +++ b/test/test_igamma_inv.cpp @@ -0,0 +1,335 @@ +// (C) Copyright John Maddock 2006. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "test_gamma_hooks.hpp" +#include "handle_test_result.hpp" + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the incomplete gamma function inverses +// gamma_P_inv and gamma_Q_inv. There are three sets of tests: +// 1) Spot tests which compare our results with selected values +// computed using the online special function calculator at +// functions.wolfram.com, +// 2) Accuracy tests use values generated with NTL::RR at +// 1000-bit precision and our generic versions of these functions. +// 3) Round trip sanity checks, use the test data for the forward +// functions, and verify that we can get (approximately) back +// where we started. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// + +void expected_results() +{ + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + const char* largest_type; +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + if(boost::math::tools::digits() == boost::math::tools::digits()) + { + largest_type = "(long\\s+)?double"; + } + else + { + largest_type = "long double"; + } +#else + largest_type = "(long\\s+)?double"; +#endif + + + // + // Catch all cases come last: + // + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*medium[^|]*", // test data group + "[^|]*", 20, 5); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*large[^|]*", // test data group + "[^|]*", 5, 2); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*small[^|]*", // test data group + "[^|]*", 2000, 500); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "float|double", // test type(s) + "[^|]*small[^|]*", // test data group + "boost::math::gamma_P_inv", 100, 50); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "float|double", // test type(s) + "[^|]*", // test data group + "boost::math::gamma_Q_inv", 30, 10); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "float|double", // test type(s) + "[^|]*", // test data group + "[^|]*", 4, 2); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "[^|]*medium[^|]*", // test data group + "[^|]*", 20, 5); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "[^|]*large[^|]*", // test data group + "[^|]*", 1000, 500); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "[^|]*small[^|]*", // test data group + "[^|]*", 3500, 500); // test function + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; +} + +template +void do_test_gamma_2(const T& data, const char* type_name, const char* test_name) +{ + // + // test gamma_P_inv(T, T) against data: + // + using namespace std; + typedef typename T::value_type row_type; + typedef typename row_type::value_type value_type; + + std::cout << test_name << " with type " << type_name << std::endl; + + // + // These sanity checks test for a round trip accuracy of one half + // of the bits in T, unless T is type float, in which case we check + // for just one decimal digit. The problem here is the sensitivity + // of the functions, not their accuracy. This test data was generated + // for the forward functions, which means that when it is used as + // the input to the inverses then it is necessarily inexact. This rounding + // of the input is what makes the data unsuitable for use as an accuracy check, + // and also demonstrates that you can't in general round-trip these functions. + // It is however a useful sanity check. + // + value_type precision = static_cast(ldexp(1.0, 1-boost::math::tools::digits()/2)) * 100; + if(boost::math::tools::digits() < 50) + precision = 1; // 1% or two decimal digits, all we can hope for when the input is truncated to float + + for(unsigned i = 0; i < data.size(); ++i) + { + // + // These inverse tests are thrown off if the output of the + // incomplete gamma is too close to 1: basically there is insuffient + // information left in the value we're using as input to the inverse + // to be able to get back to the original value. + // + if(data[i][5] == 0) + BOOST_CHECK_EQUAL(boost::math::gamma_P_inv(data[i][0], data[i][5]), value_type(0)); + else if((1 - data[i][5] > 0.001) && (fabs(data[i][5]) >= boost::math::tools::min_value())) + { + value_type inv = boost::math::gamma_P_inv(data[i][0], data[i][5]); + BOOST_CHECK_CLOSE(data[i][1], inv, precision); + } + else if(1 == data[i][5]) + BOOST_CHECK_EQUAL(boost::math::gamma_P_inv(data[i][0], data[i][5]), boost::math::tools::max_value()); + else + { + // not enough bits in our input to get back to x, but we should be in + // the same ball park: + value_type inv = boost::math::gamma_P_inv(data[i][0], data[i][5]); + BOOST_CHECK_CLOSE(data[i][1], inv, 100000); + } + + if(data[i][3] == 0) + BOOST_CHECK_EQUAL(boost::math::gamma_Q_inv(data[i][0], data[i][3]), boost::math::tools::max_value()); + else if((1 - data[i][3] > 0.001) && (fabs(data[i][3]) >= boost::math::tools::min_value())) + { + value_type inv = boost::math::gamma_Q_inv(data[i][0], data[i][3]); + BOOST_CHECK_CLOSE(data[i][1], inv, precision); + } + else if(1 == data[i][3]) + BOOST_CHECK_EQUAL(boost::math::gamma_Q_inv(data[i][0], data[i][3]), value_type(0)); + else + { + // not enough bits in our input to get back to x, but we should be in + // the same ball park: + value_type inv = boost::math::gamma_Q_inv(data[i][0], data[i][3]); + BOOST_CHECK_CLOSE(data[i][1], inv, 100); + } + } + std::cout << std::endl; +} + +template +void do_test_gamma_inv(const T& data, const char* type_name, const char* test_name) +{ + typedef typename T::value_type row_type; + typedef typename row_type::value_type value_type; + + typedef value_type (*pg)(value_type, value_type); + pg funcp = boost::math::gamma_P_inv; + + using namespace boost::lambda; + + boost::math::tools::test_result result; + + std::cout << "Testing " << test_name << " with type " << type_name + << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; + + // + // test gamma_P_inv(T, T) against data: + // + result = boost::math::tools::test( + data, + bind(funcp, ret(_1[0]), ret(_1[1])), + ret(_1[2])); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_P_inv", test_name); + // + // test gamma_Q_inv(T, T) against data: + // + funcp = boost::math::gamma_Q_inv; + result = boost::math::tools::test( + data, + bind(funcp, ret(_1[0]), ret(_1[1])), + ret(_1[3])); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::gamma_Q_inv", test_name); +} + +template +void test_gamma(T, const char* name) +{ + // + // The actual test data is rather verbose, so it's in a separate file + // + // First the data for the incomplete gamma function, each + // row has the following 6 entries: + // Parameter a, parameter z, + // Expected tgamma(a, z), Expected gamma_Q(a, z) + // Expected tgamma_lower(a, z), Expected gamma_P(a, z) + // +# include "igamma_med_data.ipp" + + do_test_gamma_2(igamma_med_data, name, "Running round trip sanity checks on incomplete gamma medium sized values"); + +# include "igamma_small_data.ipp" + + do_test_gamma_2(igamma_small_data, name, "Running round trip sanity checks on incomplete gamma small values"); + +# include "igamma_big_data.ipp" + + do_test_gamma_2(igamma_big_data, name, "Running round trip sanity checks on incomplete gamma large values"); + +# include "gamma_inv_data.ipp" + + do_test_gamma_inv(gamma_inv_data, name, "incomplete gamma inverse(a, z) medium values"); + +# include "gamma_inv_big_data.ipp" + + do_test_gamma_inv(gamma_inv_big_data, name, "incomplete gamma inverse(a, z) large values"); + +# include "gamma_inv_small_data.ipp" + + do_test_gamma_inv(gamma_inv_small_data, name, "incomplete gamma inverse(a, z) small values"); +} + +template +void test_spots(T, const char* type_name) +{ + std::cout << "Running spot checks for type " << type_name << std::cout; + // + // basic sanity checks, tolerance is 100 epsilon expressed as a percentage: + // + T tolerance = boost::math::tools::epsilon() * 10000; + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(1e-2), static_cast(1.0/128)), static_cast(0.35767144525455121503672919307647515332256996883787L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(1e-2), static_cast(1.0/2)), static_cast(4.4655350189103486773248562646452806745879516124613e-31L), tolerance); +// BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(1e-2), static_cast(1.0-1.0/128)), static_cast(3.8106736649978161389878528903698068142257930575497e-181L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(0.5), static_cast(1.0/128)), static_cast(3.5379794687984498627918583429482809311448951189097L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(0.5), static_cast(1.0/2)), static_cast(0.22746821155978637597125832348982469815821055329511L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(0.5), static_cast(1.0-1.0/128)), static_cast(0.000047938431649305382237483273209405461203600840052182L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(10), static_cast(1.0/128)), static_cast(19.221865946801723949866005318845155649972164294057L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(10), static_cast(1.0/2)), static_cast(9.6687146147141311517500637401166726067778162022664L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(10), static_cast(1.0-1.0/128)), static_cast(3.9754602513640844712089002210120603689809432130520L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(10000), static_cast(1.0/128)), static_cast(10243.369973939134157953734588122880006091919872879L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(10000), static_cast(1.0/2)), static_cast(9999.6666686420474237369661574633153551436435884101L), tolerance); + BOOST_CHECK_CLOSE(::boost::math::gamma_Q_inv(static_cast(10000), static_cast(1.0-1.0/128)), static_cast(9759.8597223369324083191194574874497413261589080204L), tolerance); +} + +int test_main(int, char* []) +{ + expected_results(); + + test_spots(0.0F, "float"); + test_spots(0.0, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + test_spots(0.0L, "long double"); + test_spots(boost::math::concepts::real_concept(0.1), "real_concept"); +#endif + + test_gamma(0.1F, "float"); + test_gamma(0.1, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + test_gamma(0.1L, "long double"); + test_gamma(boost::math::concepts::real_concept(0.1), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif + return 0; +} + + diff --git a/test/test_tgamma_ratio.cpp b/test/test_tgamma_ratio.cpp index a68e67b4c..5dd8e03d4 100644 --- a/test/test_tgamma_ratio.cpp +++ b/test/test_tgamma_ratio.cpp @@ -12,24 +12,88 @@ #include #include -template -void print_test_result(const boost::math::tools::test_result& result, - const Seq& worst, int row, const char* name, const char* test) +#include "handle_test_result.hpp" + +// +// DESCRIPTION: +// ~~~~~~~~~~~~ +// +// This file tests the gamma ratio functions tgamma_ratio, +// and tgamma_delta_ratio. The accuracy tests +// use values generated with NTL::RR at 1000-bit precision +// and our generic versions of these functions. +// +// Note that when this file is first run on a new platform many of +// these tests will fail: the default accuracy is 1 epsilon which +// is too tight for most platforms. In this situation you will +// need to cast a human eye over the error rates reported and make +// a judgement as to whether they are acceptable. Either way please +// report the results to the Boost mailing list. Acceptable rates of +// error are marked up below as a series of regular expressions that +// identify the compiler/stdlib/platform/data-type/test-data/test-function +// along with the maximum expected peek and RMS mean errors for that +// test. +// + +void expected_results() { - using namespace std; - T eps = pow(T(2), 1-boost::math::tools::digits()); - std::cout << setprecision(4); - std::cout << test << "(" << name << ") Max = " << (result.stat.max)()/eps - << " RMS Mean=" << result.stat.rms()/eps - << "\n worst case at row: " - << row << "\n { "; - for(unsigned i = 0; i < worst.size(); ++i) + // + // Define the max and mean errors expected for + // various compilers and platforms. + // + const char* largest_type; +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + if(boost::math::tools::digits() == boost::math::tools::digits()) { - if(i) - std::cout << ", "; - std::cout << worst[i]; + largest_type = "(long\\s+)?double"; } - std::cout << " }" << std::endl; + else + { + largest_type = "long double"; + } +#else + largest_type = "(long\\s+)?double"; +#endif + + + // + // Catch all cases come last: + // + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*", // test data group + "boost::math::tgamma_delta_ratio[^|]*", 20, 10); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + largest_type, // test type(s) + "[^|]*", // test data group + "boost::math::tgamma_ratio[^|]*", 40, 20); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "[^|]*", // test data group + "boost::math::tgamma_delta_ratio[^|]*", 30, 15); // test function + add_expected_result( + "[^|]*", // compiler + "[^|]*", // stdlib + "[^|]*", // platform + "real_concept", // test type(s) + "[^|]*", // test data group + "boost::math::tgamma_ratio[^|]*", 150, 50); // test function + + // + // Finish off by printing out the compiler/stdlib/platform names, + // we do this to make it easier to mark up expected error rates. + // + std::cout << "Tests run with " << BOOST_COMPILER << ", " + << BOOST_STDLIB << ", " << BOOST_PLATFORM << std::endl; } template @@ -55,14 +119,14 @@ void do_test_tgamma_delta_ratio(const T& data, const char* type_name, const char boost::lambda::ret(boost::lambda::_1[0]), boost::lambda::ret(boost::lambda::_1[1])), boost::lambda::ret(boost::lambda::_1[2])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::tgamma_delta_ratio(a, delta)"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a, delta)", test_name); result = boost::math::tools::test( data, boost::lambda::bind(funcp, boost::lambda::ret(boost::lambda::_1[0]), -boost::lambda::ret(boost::lambda::_1[1])), boost::lambda::ret(boost::lambda::_1[3])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::tgamma_delta_ratio(a -delta)"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_delta_ratio(a -delta)", test_name); } template @@ -88,7 +152,7 @@ void do_test_tgamma_ratio(const T& data, const char* type_name, const char* test boost::lambda::ret(boost::lambda::_1[0]), boost::lambda::ret(boost::lambda::_1[1])), boost::lambda::ret(boost::lambda::_1[2])); - print_test_result(result, data[result.worst_case], result.worst_case, type_name, "boost::math::tgamma_ratio(a, b)"); + handle_test_result(result, data[result.worst()], result.worst(), type_name, "boost::math::tgamma_ratio(a, b)", test_name); } template @@ -109,10 +173,19 @@ void test_tgamma_ratio(T, const char* name) int test_main(int, char* []) { + expected_results(); + test_tgamma_ratio(0.1F, "float"); test_tgamma_ratio(0.1, "double"); +#ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS test_tgamma_ratio(0.1L, "long double"); test_tgamma_ratio(boost::math::concepts::real_concept(0.1), "real_concept"); +#else + std::cout << "The long double tests have been disabled on this platform " + "either because the long double overloads of the usual math functions are " + "not available at all, or because they are too inaccurate for these tests " + "to pass." << std::cout; +#endif return 0; }