📄 powm1_sqrtp1m1_test.cpp
字号:
// (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 <boost/math/concepts/real_concept.hpp>#include <boost/test/included/test_exec_monitor.hpp>#include <boost/test/floating_point_comparison.hpp>#include <boost/math/special_functions/sqrt1pm1.hpp>#include <boost/math/special_functions/powm1.hpp>#include <boost/math/tools/test.hpp>#include <boost/array.hpp>#include "functor.hpp"#include "handle_test_result.hpp"//// DESCRIPTION:// ~~~~~~~~~~~~//// This file tests the functions powm1 and sqrt1pm1. // 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 ".*", 5, 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 <class T>void test_powm1_sqrtp1m1(T, const char* type_name){#define SC_(x) static_cast<T>(BOOST_JOIN(x, L)) static const boost::array<boost::array<T, 2>, 141> sqrtp1m1_data = { SC_(-0.990433037281036376953125), SC_(-0.902189148255607021082179865003660033379), SC_(-0.928576648235321044921875), SC_(-0.7327485233629588435419837213946140663952), SC_(-0.804919183254241943359375), SC_(-0.5583204592175928547330219789723812512248), SC_(-0.780276477336883544921875), SC_(-0.5312532425038905348288090678272629719499), SC_(-0.775070965290069580078125), SC_(-0.525733160857803152349794525146692520785), SC_(-0.74602639675140380859375), SC_(-0.4960420620244223284705423670972348730775), SC_(-0.72904598712921142578125), SC_(-0.4794675678972648545670296583048773096015), SC_(-0.7162272930145263671875), SC_(-0.4672967927771847619430106324762494277417), SC_(-0.68477380275726318359375), SC_(-0.4385499156267435234127335149836228483716), SC_(-0.62323606014251708984375), SC_(-0.3861890031471553130754715740017444288273), SC_(-0.576151371002197265625), SC_(-0.3489634196162225368137418186622322770468), SC_(-0.5579319000244140625), SC_(-0.3351179804088653673227401220715512851566), SC_(-0.44300353527069091796875), SC_(-0.2536780421766293214167684432407843582845), SC_(-0.40594112873077392578125), SC_(-0.2292478535422518369418742953348121057781), SC_(-0.38366591930389404296875), SC_(-0.2149305249240001453212315877592832894955), SC_(-0.277411997318267822265625), SC_(-0.1499482352928545459530860365223688354153), SC_(-0.202522933483123779296875), SC_(-0.1069842854031759981174720343292165991554), SC_(-0.156477451324462890625), SC_(-0.08156516362044655434273010203540784115386), SC_(-0.029248714447021484375), SC_(-0.01473288619127324715091701268111937769847), SC_(0.1431564604442703013402649929484277542953e-29), SC_(0.7157823022213515067013249647418825993242e-30), SC_(0.1791466932348087634896446282571611213266e-29), SC_(0.8957334661740438174482231412854044374117e-30), SC_(0.6013619202535540063110633226832922483532e-29), SC_(0.3006809601267770031555316613411940789777e-29), SC_(0.115805324961653822428570241697281798758e-28), SC_(0.5790266248082691121428512084847326346288e-29), SC_(0.1422457400834001098175711728787848259007e-28), SC_(0.711228700417000549087855864391394898182e-29), SC_(0.4970121018327539153628705477876439795096e-28), SC_(0.2485060509163769576814352738907342268877e-28), SC_(0.9660079415057497591758174164417478444323e-28), SC_(0.483003970752874879587908708209209280428e-28), SC_(0.1232929313253182131376331095427391968754e-27), SC_(0.6164646566265910656881655476946945507336e-28), SC_(0.3296523285617759312781860549364832953326e-27), SC_(0.1648261642808879656390930274546578154505e-27), SC_(0.528364435768055252017009628713605422886e-27), SC_(0.26418221788402762600850481432190658932e-27), SC_(0.886586057273120049620324386849842094685e-27), SC_(0.4432930286365600248101621933266666927236e-27), SC_(0.2499669674831043259218157022821422146034e-26), SC_(0.1249834837415521629609078510629667512608e-26), SC_(0.4131050397232622964314362671638736040881e-26), SC_(0.2065525198616311482157181333686170847381e-26), SC_(0.7679738097881433551381658732998641759182e-26), SC_(0.3839869048940716775690829359127023723085e-26), SC_(0.199929739820949207249437007767740538737e-25), SC_(0.9996486991047460362471850338422150855758e-26), SC_(0.5151477415246978459754129800826163591626e-25), SC_(0.2575738707623489229877064867240932346063e-25), SC_(0.101200734533556026342258477595279955025e-24), SC_(0.5060036726677801317112923751744139374608e-25), SC_(0.2064292695896540981798546456623054911033e-24), SC_(0.1032146347948270490899273175045223276369e-24), SC_(0.4063294332896333395257434433879773416284e-24), SC_(0.2031647166448166697628717010560376261299e-24),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -