mapairy.hpp 250 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221
  1. // Copyright Takuma Yoshimura 2024.
  2. // Copyright Matt Borland 2024.
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_STATS_MAPAIRY_HPP
  7. #define BOOST_STATS_MAPAIRY_HPP
  8. #ifdef _MSC_VER
  9. #pragma warning(push)
  10. #pragma warning(disable : 4127) // conditional expression is constant
  11. #endif
  12. #include <boost/math/tools/config.hpp>
  13. #include <boost/math/tools/numeric_limits.hpp>
  14. #include <boost/math/tools/tuple.hpp>
  15. #include <boost/math/constants/constants.hpp>
  16. #include <boost/math/tools/big_constant.hpp>
  17. #include <boost/math/distributions/complement.hpp>
  18. #include <boost/math/distributions/detail/common_error_handling.hpp>
  19. #include <boost/math/distributions/detail/derived_accessors.hpp>
  20. #include <boost/math/tools/rational.hpp>
  21. #include <boost/math/special_functions/cbrt.hpp>
  22. #include <boost/math/policies/policy.hpp>
  23. #include <boost/math/policies/error_handling.hpp>
  24. #include <boost/math/tools/promotion.hpp>
  25. #ifndef BOOST_MATH_HAS_NVRTC
  26. #include <boost/math/distributions/fwd.hpp>
  27. #include <cmath>
  28. #endif
  29. namespace boost { namespace math {
  30. template <class RealType, class Policy>
  31. class mapairy_distribution;
  32. namespace detail {
  33. template <class RealType>
  34. BOOST_MATH_GPU_ENABLED inline RealType mapairy_pdf_plus_imp_prec(const RealType& x, const boost::math::integral_constant<int, 53>&)
  35. {
  36. BOOST_MATH_STD_USING
  37. RealType result;
  38. if (x < 1) {
  39. // Rational Approximation
  40. // Maximum Relative Error: 3.7591e-18
  41. BOOST_MATH_STATIC const RealType P[8] = {
  42. static_cast<RealType>(1.97516171847191855610e-1),
  43. static_cast<RealType>(3.67488253628465083737e-2),
  44. static_cast<RealType>(-9.73242224038828612673e-4),
  45. static_cast<RealType>(2.32207514136635673061e-3),
  46. static_cast<RealType>(5.69067907423210669037e-5),
  47. static_cast<RealType>(-6.02637387141524535193e-5),
  48. static_cast<RealType>(1.04960324426666933327e-5),
  49. static_cast<RealType>(-6.58470237954242016920e-7),
  50. };
  51. BOOST_MATH_STATIC const RealType Q[7] = {
  52. static_cast<RealType>(1.),
  53. static_cast<RealType>(7.09464351647314165710e-1),
  54. static_cast<RealType>(3.66413036246461392316e-1),
  55. static_cast<RealType>(1.10947882302862241488e-1),
  56. static_cast<RealType>(2.65928486676817177159e-2),
  57. static_cast<RealType>(3.75507284977386290874e-3),
  58. static_cast<RealType>(4.03789594641339005785e-4),
  59. };
  60. result = tools::evaluate_polynomial(P, x) / tools::evaluate_polynomial(Q, x);
  61. }
  62. else if (x < 2) {
  63. RealType t = x - 1;
  64. // Rational Approximation
  65. // Maximum Relative Error: 1.5996e-20
  66. BOOST_MATH_STATIC const RealType P[8] = {
  67. static_cast<RealType>(1.06251243013238748252e-1),
  68. static_cast<RealType>(1.38178831205785069108e-2),
  69. static_cast<RealType>(4.19280374368049006206e-3),
  70. static_cast<RealType>(8.54607219684690930289e-4),
  71. static_cast<RealType>(-7.46881084120928210702e-5),
  72. static_cast<RealType>(1.47110856483345063335e-5),
  73. static_cast<RealType>(-1.30090180307471994500e-6),
  74. static_cast<RealType>(5.24801123304330014713e-8),
  75. };
  76. BOOST_MATH_STATIC const RealType Q[8] = {
  77. static_cast<RealType>(1.),
  78. static_cast<RealType>(8.10853683888611687140e-1),
  79. static_cast<RealType>(3.89361261627717143905e-1),
  80. static_cast<RealType>(1.15124062681082170577e-1),
  81. static_cast<RealType>(2.38803416611949902468e-2),
  82. static_cast<RealType>(3.08616898814509065071e-3),
  83. static_cast<RealType>(2.43760043942846261876e-4),
  84. static_cast<RealType>(1.34538901435238836768e-6),
  85. };
  86. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  87. }
  88. else if (x < 4) {
  89. RealType t = x - 2;
  90. // Rational Approximation
  91. // Maximum Relative Error: 1.1592e-17
  92. BOOST_MATH_STATIC const RealType P[9] = {
  93. static_cast<RealType>(5.33842514891989443409e-2),
  94. static_cast<RealType>(1.23301980674903270971e-2),
  95. static_cast<RealType>(3.45717831433988631923e-3),
  96. static_cast<RealType>(3.27034449923176875761e-4),
  97. static_cast<RealType>(1.20406794831890291348e-5),
  98. static_cast<RealType>(5.77489170397965604669e-7),
  99. static_cast<RealType>(-1.15255267205685159063e-7),
  100. static_cast<RealType>(9.15896323073109992939e-9),
  101. static_cast<RealType>(-3.14068002815368247985e-10),
  102. };
  103. BOOST_MATH_STATIC const RealType Q[7] = {
  104. static_cast<RealType>(1.),
  105. static_cast<RealType>(9.08772985520393226044e-1),
  106. static_cast<RealType>(4.26418573702560818267e-1),
  107. static_cast<RealType>(1.22033746594868893316e-1),
  108. static_cast<RealType>(2.27934009200310243172e-2),
  109. static_cast<RealType>(2.60658999011198623962e-3),
  110. static_cast<RealType>(1.54461660261435227768e-4),
  111. };
  112. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  113. }
  114. else if (x < 8) {
  115. RealType t = x - 4;
  116. // Rational Approximation
  117. // Maximum Relative Error: 9.2228e-17
  118. BOOST_MATH_STATIC const RealType P[8] = {
  119. static_cast<RealType>(1.58950538583133457384e-2),
  120. static_cast<RealType>(7.47835440063141601948e-3),
  121. static_cast<RealType>(1.81137244353261478410e-3),
  122. static_cast<RealType>(2.26935565382135588558e-4),
  123. static_cast<RealType>(1.43877113825683795505e-5),
  124. static_cast<RealType>(2.08242747557417233626e-7),
  125. static_cast<RealType>(-1.54976465724771282989e-9),
  126. static_cast<RealType>(1.30762989300333026019e-11),
  127. };
  128. BOOST_MATH_STATIC const RealType Q[8] = {
  129. static_cast<RealType>(1.),
  130. static_cast<RealType>(9.95505437381674174441e-1),
  131. static_cast<RealType>(4.58882737262511297099e-1),
  132. static_cast<RealType>(1.25031310192148865496e-1),
  133. static_cast<RealType>(2.15727229249904102247e-2),
  134. static_cast<RealType>(2.33597081566665672569e-3),
  135. static_cast<RealType>(1.45198998318300328562e-4),
  136. static_cast<RealType>(3.87962234445835345676e-6),
  137. };
  138. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  139. }
  140. else if (x < 16) {
  141. RealType t = x - 8;
  142. // Rational Approximation
  143. // Maximum Relative Error: 1.0257e-17
  144. BOOST_MATH_STATIC const RealType P[8] = {
  145. static_cast<RealType>(3.22517551525042172428e-3),
  146. static_cast<RealType>(1.12822806030796339659e-3),
  147. static_cast<RealType>(1.54489389961322571031e-4),
  148. static_cast<RealType>(9.28479992527909796427e-6),
  149. static_cast<RealType>(2.06168350199745832262e-7),
  150. static_cast<RealType>(9.05110751997021418539e-10),
  151. static_cast<RealType>(-2.15498112371756202097e-12),
  152. static_cast<RealType>(6.41838355699777435924e-15),
  153. };
  154. BOOST_MATH_STATIC const RealType Q[8] = {
  155. static_cast<RealType>(1.),
  156. static_cast<RealType>(6.53390465399680164234e-1),
  157. static_cast<RealType>(1.82759048270449018482e-1),
  158. static_cast<RealType>(2.80407546367978533849e-2),
  159. static_cast<RealType>(2.50853443923476718145e-3),
  160. static_cast<RealType>(1.27671852825846245421e-4),
  161. static_cast<RealType>(3.28380135691060279203e-6),
  162. static_cast<RealType>(3.06545317089055335742e-8),
  163. };
  164. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  165. }
  166. else if (x < 32) {
  167. RealType t = x - 16;
  168. // Rational Approximation
  169. // Maximum Relative Error: 6.0510e-17
  170. BOOST_MATH_STATIC const RealType P[8] = {
  171. static_cast<RealType>(5.82527663232857270992e-4),
  172. static_cast<RealType>(6.89502117025124630567e-5),
  173. static_cast<RealType>(2.24909795087265741433e-6),
  174. static_cast<RealType>(2.18576787334972903790e-8),
  175. static_cast<RealType>(3.39014723444178274435e-11),
  176. static_cast<RealType>(-9.74481309265612390297e-15),
  177. static_cast<RealType>(-1.13308546492906818388e-16),
  178. static_cast<RealType>(5.32472028720777735712e-19),
  179. };
  180. BOOST_MATH_STATIC const RealType Q[7] = {
  181. static_cast<RealType>(1.),
  182. static_cast<RealType>(2.74018883667663396766e-1),
  183. static_cast<RealType>(2.95901195665990089660e-2),
  184. static_cast<RealType>(1.57901733512147920251e-3),
  185. static_cast<RealType>(4.24965124147621236633e-5),
  186. static_cast<RealType>(5.17522027193205842016e-7),
  187. static_cast<RealType>(2.00522219276570039934e-9),
  188. };
  189. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  190. }
  191. else if (x < 64) {
  192. RealType t = x - 32;
  193. // Rational Approximation
  194. // Maximum Relative Error: 7.3294e-18
  195. BOOST_MATH_STATIC const RealType P[8] = {
  196. static_cast<RealType>(1.03264853379349880039e-4),
  197. static_cast<RealType>(5.35256306644392405447e-6),
  198. static_cast<RealType>(9.00657716972118816692e-8),
  199. static_cast<RealType>(5.34913574042209793720e-10),
  200. static_cast<RealType>(6.70752605041678779380e-13),
  201. static_cast<RealType>(-5.30089923101856817552e-16),
  202. static_cast<RealType>(7.28133811621687143754e-19),
  203. static_cast<RealType>(-7.38047553655951666420e-22),
  204. };
  205. BOOST_MATH_STATIC const RealType Q[7] = {
  206. static_cast<RealType>(1.),
  207. static_cast<RealType>(1.29920843258164337377e-1),
  208. static_cast<RealType>(6.75018577147646502386e-3),
  209. static_cast<RealType>(1.77694968039695671819e-4),
  210. static_cast<RealType>(2.46428299911920942946e-6),
  211. static_cast<RealType>(1.67165053157990942546e-8),
  212. static_cast<RealType>(4.19496974141131087116e-11),
  213. };
  214. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  215. }
  216. else {
  217. RealType t = 1 / sqrt(x * x * x);
  218. // Rational Approximation
  219. // Maximum Relative Error: 5.6693e-20
  220. BOOST_MATH_STATIC const RealType P[5] = {
  221. static_cast<RealType>(5.98413420602149016910e-1),
  222. static_cast<RealType>(3.14584075817417883086e-5),
  223. static_cast<RealType>(1.62977928311793051895e1),
  224. static_cast<RealType>(-4.12903117172994371875e-4),
  225. static_cast<RealType>(-1.06404478702135751872e2),
  226. };
  227. BOOST_MATH_STATIC const RealType Q[3] = {
  228. static_cast<RealType>(1.),
  229. static_cast<RealType>(5.25696892802060720079e-5),
  230. static_cast<RealType>(4.03600055498020483920e1),
  231. };
  232. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t) * t / x;
  233. }
  234. return result;
  235. }
  236. template <class RealType>
  237. BOOST_MATH_GPU_ENABLED inline RealType mapairy_pdf_plus_imp_prec(const RealType& x, const boost::math::integral_constant<int, 113>&)
  238. {
  239. BOOST_MATH_STD_USING
  240. RealType result;
  241. if (x < 1) {
  242. // Rational Approximation
  243. // Maximum Relative Error: 7.8308e-35
  244. // LCOV_EXCL_START
  245. BOOST_MATH_STATIC const RealType P[13] = {
  246. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.97516171847191855609649452292217911973e-1),
  247. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.17531822787252717270400174744562144891e-1),
  248. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.85115358761409188259685286269086053296e-2),
  249. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.18029395189535552537870932989876189597e-2),
  250. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.77412874842522285996566741532939343827e-3),
  251. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.77992070255086842672551073580133785334e-4),
  252. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.54573264286260796576738952968288691782e-5),
  253. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.94764012694602906119831079380500255557e-6),
  254. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.97596258932025712802674070104281981323e-7),
  255. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.45466169112247379589927514614067756956e-8),
  256. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.99760415118300349769641418430273526815e-10),
  257. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.43150486566834492207695241913522311930e-13),
  258. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.46130347604880355784938321408765318948e-13),
  259. };
  260. BOOST_MATH_STATIC const RealType Q[13] = {
  261. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  262. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.11845869711743584628289654085905424438e0),
  263. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.80391154854347711297249357734993136108e-1),
  264. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.75628443538173255184583966965162835227e-1),
  265. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.41016303833742742212624596040074202424e-1),
  266. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.19142300833563644046500846364541891138e-2),
  267. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.02421707708633106515934651956262614532e-2),
  268. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.03973732602338507411104824853671547615e-3),
  269. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.35206168908201402570766383018708660819e-4),
  270. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.38602606623008690327520130558254165564e-5),
  271. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.53740175911385378188372963739884519312e-6),
  272. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.27513004715414297729539702862351044344e-7),
  273. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.54510493017251997793679126704007098265e-8),
  274. };
  275. // LCOV_EXCL_STOP
  276. result = tools::evaluate_polynomial(P, x) / tools::evaluate_polynomial(Q, x);
  277. }
  278. else if (x < 2) {
  279. RealType t = x - 1;
  280. // Rational Approximation
  281. // Maximum Relative Error: 3.0723e-35
  282. // LCOV_EXCL_START
  283. BOOST_MATH_STATIC const RealType P[12] = {
  284. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.06251243013238748252181151646220197947e-1),
  285. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.92438638323563234519452281479338921158e-2),
  286. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.83335793178622701784730867677919844599e-2),
  287. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.84159075203218824591724451142550478306e-3),
  288. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.04213732090358859917896442076931334722e-3),
  289. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.72388220651785798237487005913708387756e-4),
  290. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.36099324022668533012286817710272936865e-5),
  291. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.74483270731217433628720245792741986795e-6),
  292. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.56461597064783966758904403291149549559e-7),
  293. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.28590608939674970691948223694855264817e-8),
  294. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.81756745849477762773082030302943341729e-10),
  295. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.65915115243311285178083515017249358853e-12),
  296. };
  297. BOOST_MATH_STATIC const RealType Q[13] = {
  298. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  299. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.33250387018216706082200927591739589024e0),
  300. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.71707718560216685629188467984384070512e-1),
  301. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.81316277289673837399162302797006618384e-1),
  302. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.78475951599121894570443981591530879087e-1),
  303. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.16167801098514576400689883575304687623e-2),
  304. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19167794366424137722223009369062644830e-2),
  305. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.20831082064982892777497773490792080382e-3),
  306. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.27196399162146247210036306870401328410e-4),
  307. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.79335434374966775903734846875100087590e-5),
  308. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.30825409557870847168672662674521614782e-6),
  309. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.97296173230649275943984471731360073540e-7),
  310. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.48943057909563158917114503727080517958e-9),
  311. };
  312. // LCOV_EXCL_STOP
  313. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  314. }
  315. else if (x < 4) {
  316. RealType t = x - 2;
  317. // Rational Approximation
  318. // Maximum Relative Error: 4.0903e-35
  319. // LCOV_EXCL_START
  320. BOOST_MATH_STATIC const RealType P[13] = {
  321. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.33842514891989443409465171800884519331e-2),
  322. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.53264053296761245408991932692426094424e-2),
  323. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.23210520807186629205810670362048049836e-2),
  324. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.71104271443590027208545022968625306496e-3),
  325. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.98781446716778138729774954595209697813e-3),
  326. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.98895829308616657174932023565302947632e-4),
  327. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.25993639218721804661037829873135732687e-5),
  328. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.64669776700609853276056375742089715662e-6),
  329. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.11846243382610611156151291892877027869e-7),
  330. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.74830086064868141326053648144496072795e-8),
  331. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.07549997153431643849551871367000763445e-9),
  332. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.10030596535721362628619523622308581344e-11),
  333. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19376016170255697546854583591494809062e-13),
  334. };
  335. BOOST_MATH_STATIC const RealType Q[15] = {
  336. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  337. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.52686177278870816414637961315363468426e0),
  338. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19872083945442288336636376283295310445e0),
  339. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.26633866969676511944680471882188527224e-1),
  340. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.41261867539396133951024374504099977090e-1),
  341. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.18852182132645783844766153200510014113e-2),
  342. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.70152126044106007357033814742158353948e-2),
  343. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.23810508827493234517751339979902448944e-3),
  344. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.96161313274648769113605163816403306967e-4),
  345. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.06693316156193327359541953619174255726e-5),
  346. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.79366356086062616343285660797389238271e-6),
  347. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.14585835815353770175366834099001313472e-7),
  348. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.05314631662369743547568064896403143693e-8),
  349. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.90325380271096603676911761784650800378e-10),
  350. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.36933359079566550212098911224675011839e-12),
  351. };
  352. // LCOV_EXCL_STOP
  353. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  354. }
  355. else if (x < 8) {
  356. RealType t = x - 4;
  357. // Rational Approximation
  358. // Maximum Relative Error: 6.5015e-35
  359. // LCOV_EXCL_START
  360. BOOST_MATH_STATIC const RealType P[15] = {
  361. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.58950538583133457383574346194006716984e-2),
  362. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.25447644411503971725638816502617490834e-2),
  363. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.47605882774114100209665040117276675598e-2),
  364. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.12224864838900383464124716266085521485e-3),
  365. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.79164249640537972514574059182421325541e-3),
  366. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.89668438166714230032406615413991628135e-4),
  367. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.44410389750700463263686630222653669837e-5),
  368. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.14788978994687095829140113472609739982e-6),
  369. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.79821680629333600844514042061772236495e-7),
  370. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.49636960435731257154960798035854124639e-8),
  371. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.70554745768928821263556963261516872171e-9),
  372. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.42293994855343109617040824208078534205e-11),
  373. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.37599287094703195312894833570340165019e-12),
  374. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.35248179978735448062307216459232932068e-15),
  375. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.53569375838863862590910010617140120876e-18),
  376. };
  377. BOOST_MATH_STATIC const RealType Q[17] = {
  378. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  379. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.94337325681904859647161946168957959628e0),
  380. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.77120402023938328899162557073347121463e0),
  381. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.01644685191130734907530007424741314392e0),
  382. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.12479655123720440909164080517207084404e-1),
  383. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.25556010526357752360439314019567992245e-1),
  384. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.96143273204038192262150849394970544022e-2),
  385. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.50612932318889495209230176354364299236e-3),
  386. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.12160918304376427109905628326638480473e-4),
  387. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.47696044292604039527013647985997661762e-5),
  388. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.64067652576843720823459199100800335854e-6),
  389. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.00745166063635113130434111509648306420e-7),
  390. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.05398901239421768403763864060147286105e-8),
  391. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.05698259572340563109985785513355912114e-9),
  392. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.19362835269415404005406782719825077472e-11),
  393. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.15444386779802728200716489787161419304e-13),
  394. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.02452666470008756043350040893761339083e-16),
  395. };
  396. // LCOV_EXCL_STOP
  397. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  398. }
  399. else if (x < 16) {
  400. RealType t = x - 8;
  401. // Rational Approximation
  402. // Maximum Relative Error: 2.0995e-35
  403. // LCOV_EXCL_START
  404. BOOST_MATH_STATIC const RealType P[16] = {
  405. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.22517551525042172427941302520759668293e-3),
  406. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.86576974828476461442549217748945498966e-3),
  407. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.18419822818191546598384139622512477000e-3),
  408. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.98396184944524020019688823190946146641e-4),
  409. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.06686400532599396487775148973665625687e-5),
  410. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.05680178109228687159829475615095925679e-6),
  411. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.17554487015345146749705505971350254902e-7),
  412. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.14774751685364429557883242232797329274e-8),
  413. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.33266124509168360207594600356349282805e-9),
  414. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.76332756800842989348756910429214676252e-11),
  415. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.60639771339252642992277508068105926919e-13),
  416. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.41859490403554144799385471141184829903e-15),
  417. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.77177795293424055655391515546880774987e-17),
  418. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.76106923344461402353501262620681801053e-20),
  419. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.68829978902134103249656805130103045021e-23),
  420. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.42496376687241918803028631991083570963e-26),
  421. };
  422. BOOST_MATH_STATIC const RealType Q[16] = {
  423. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  424. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19213376162053391168605415200906099633e0),
  425. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.65578261958732385181558047087365997878e-1),
  426. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.30046653564394292929001223763106276016e-1),
  427. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.48388301731958697028701215596777178117e-2),
  428. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.50873786049439122933188684993719288258e-3),
  429. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.23255654647151798865208394342856435797e-3),
  430. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.20861791399969402003082323686080041040e-4),
  431. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.96882049090731653763684812243275884213e-6),
  432. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.98669985741073085290012296575736698103e-7),
  433. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.03383311816835346577432387682379226740e-8),
  434. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.87320682938150375144724980774245810905e-10),
  435. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.13573468677076838075146150847170057373e-11),
  436. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.34526045003716422620879156626237175127e-13),
  437. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.35681579117696161282979297336282783473e-16),
  438. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.92944288060269290125987728528698476197e-18),
  439. };
  440. // LCOV_EXCL_STOP
  441. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  442. }
  443. else if (x < 32) {
  444. RealType t = x - 16;
  445. // Rational Approximation
  446. // Maximum Relative Error: 2.0937e-35
  447. // LCOV_EXCL_START
  448. BOOST_MATH_STATIC const RealType P[15] = {
  449. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.82527663232857270992129793621400616909e-4),
  450. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.41696401156754081476312871174198295322e-4),
  451. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.42036620449365724707919875710197564857e-5),
  452. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.67076745288708619632303078677641380627e-6),
  453. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.14278954094278648593125010577441869646e-7),
  454. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.40092485054621853149602511539550254471e-8),
  455. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.17755660009065973828053533035808718033e-10),
  456. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.23871371557251644837598540542648782066e-12),
  457. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.04069998646037977439620128812310273053e-13),
  458. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.94055978349016208777803296823455779097e-16),
  459. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.29866428982892883091537921429389750973e-18),
  460. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.06056281963023929277728535486590256573e-21),
  461. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.57963857545037466186123981516026589992e-24),
  462. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.81390322233700529779563477285232205886e-28),
  463. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.52190981930441828041102818178755246228e-31),
  464. };
  465. BOOST_MATH_STATIC const RealType Q[15] = {
  466. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  467. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.70564782441895707961338319466546005093e-1),
  468. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.47770566490107388849474183308889339231e-1),
  469. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.29364672385303439788399215507370006639e-2),
  470. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.37279274083988250795581105436675097881e-3),
  471. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.72124151284421794872333348562536468054e-4),
  472. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.96970247774973902625712414297788402746e-6),
  473. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.38395055453444011915661055983937917120e-7),
  474. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.19605460410208704830882138883730331113e-9),
  475. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.76945301389475508747530234950023648137e-10),
  476. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.33624384932503964160642677987886086890e-12),
  477. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.01155130710615988897664213446593907596e-14),
  478. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.03959317021567084067518847978890548086e-16),
  479. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.78213669817351488671519066803835958715e-19),
  480. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.75492332026736176991870807903277324902e-22),
  481. };
  482. // LCOV_EXCL_STOP
  483. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  484. }
  485. else if (x < 64) {
  486. RealType t = x - 32;
  487. // Rational Approximation
  488. // Maximum Relative Error: 1.5856e-35
  489. // LCOV_EXCL_START
  490. BOOST_MATH_STATIC const RealType P[15] = {
  491. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.03264853379349880038687006045193401399e-4),
  492. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.79539964604630527636184900467871907171e-5),
  493. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.34840369549460790638336121351837912308e-6),
  494. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.73087351972154879439617719914590729748e-8),
  495. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.51775493325347153520115736204545037264e-9),
  496. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.60104651860674451546102708885530128768e-11),
  497. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.90233449697112559539826150932808197444e-13),
  498. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.06978852724410115655105118663137681992e-15),
  499. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.00399855296672416041126220131900937128e-18),
  500. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.18139748830278263202087699889457673035e-20),
  501. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.43070756487288399784700274808326343543e-23),
  502. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.70126687893706466023887757573369648552e-27),
  503. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.29405234560873665664952418690159194840e-30),
  504. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.69069082510020066864633718082941688708e-34),
  505. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.33468198065176301137949068264633336529e-37),
  506. };
  507. BOOST_MATH_STATIC const RealType Q[14] = {
  508. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  509. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.51951069241510130465691156908893803280e-1),
  510. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.84647597299970149588010858770320631739e-2),
  511. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.90239396588176334117512714878489376365e-3),
  512. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.35551585337774834346900776840459179841e-5),
  513. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.53375746264539501168763602838029023222e-6),
  514. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.42421935941736734247914078641324315900e-8),
  515. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.23835501607741697737129504173606231513e-10),
  516. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.79603272375172813955236187874231935324e-12),
  517. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.44624821303153251954931367754173356213e-14),
  518. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.10635081308984534416704147448323126303e-16),
  519. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.14627867347129520510628554651739571006e-19),
  520. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.43792928765659831045040802615903432044e-21),
  521. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.79856365207259871336606847582889916798e-25),
  522. };
  523. // LCOV_EXCL_STOP
  524. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  525. }
  526. else {
  527. RealType t = 1 / sqrt(x * x * x);
  528. // Rational Approximation
  529. // Maximum Relative Error: 3.5081e-36
  530. // LCOV_EXCL_START
  531. BOOST_MATH_STATIC const RealType P[8] = {
  532. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.98413420602149016909919089901572802714e-1),
  533. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.30303835860684077803651094768293625633e-1),
  534. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.89097726237252419724261295392691855545e1),
  535. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.12696604472230480273239741428914666511e1),
  536. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.84517621403071494824886152940942995151e3),
  537. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.67577378292168927009421205756730205227e2),
  538. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.16343347002845084264982358165052437094e3),
  539. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.59558963351172885545760841064831356701e3),
  540. };
  541. BOOST_MATH_STATIC const RealType Q[7] = {
  542. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  543. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.51965956124978480521462518750569617550e-1),
  544. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.61700833299761977287211297600922591853e2),
  545. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.94988298508869748383898344668918510537e1),
  546. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.52494213749069142804725453333400335525e3),
  547. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.20093079283917759611690534481918040882e3),
  548. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.82564796242972192725215815897475246715e4),
  549. };
  550. // LCOV_EXCL_STOP
  551. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t) * t / x;
  552. }
  553. return result;
  554. }
  555. template <class RealType>
  556. BOOST_MATH_GPU_ENABLED inline RealType mapairy_pdf_minus_imp_prec(const RealType& x, const boost::math::integral_constant<int, 53>&)
  557. {
  558. BOOST_MATH_STD_USING
  559. RealType result;
  560. if (x >= -1) {
  561. RealType t = x + 1;
  562. // Rational Approximation
  563. // Maximum Relative Error: 3.7525e-17
  564. BOOST_MATH_STATIC const RealType P[8] = {
  565. static_cast<RealType>(2.76859868856746781256e-1),
  566. static_cast<RealType>(1.10489814676299003241e-1),
  567. static_cast<RealType>(-6.25690643488236678667e-3),
  568. static_cast<RealType>(-1.17905420222527577236e-3),
  569. static_cast<RealType>(1.27188963720084274122e-3),
  570. static_cast<RealType>(-7.20575105181207907889e-5),
  571. static_cast<RealType>(-2.22575633858411851032e-5),
  572. static_cast<RealType>(2.94270091008508492304e-6),
  573. };
  574. BOOST_MATH_STATIC const RealType Q[7] = {
  575. static_cast<RealType>(1.),
  576. static_cast<RealType>(4.98673671503410894284e-1),
  577. static_cast<RealType>(3.15907666864554716291e-1),
  578. static_cast<RealType>(8.34463558393629855977e-2),
  579. static_cast<RealType>(2.71804643993972494173e-2),
  580. static_cast<RealType>(3.52187050938036578406e-3),
  581. static_cast<RealType>(7.03072974279509263844e-4),
  582. };
  583. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  584. }
  585. else if (x >= -2) {
  586. RealType t = x + 2;
  587. // Rational Approximation
  588. // Maximum Relative Error: 4.0995e-17
  589. BOOST_MATH_STATIC const RealType P[8] = {
  590. static_cast<RealType>(2.14483832832989822788e-1),
  591. static_cast<RealType>(3.72789690317712876663e-1),
  592. static_cast<RealType>(1.86473650057086284496e-1),
  593. static_cast<RealType>(1.31182724166379598907e-2),
  594. static_cast<RealType>(-9.00695064809774432392e-3),
  595. static_cast<RealType>(3.46884420664996747052e-4),
  596. static_cast<RealType>(4.88651392754189961173e-4),
  597. static_cast<RealType>(-6.13516242712196835055e-5),
  598. };
  599. BOOST_MATH_STATIC const RealType Q[8] = {
  600. static_cast<RealType>(1.),
  601. static_cast<RealType>(1.06478618107122200489e0),
  602. static_cast<RealType>(4.08809060854459518663e-1),
  603. static_cast<RealType>(2.66617598099501800866e-1),
  604. static_cast<RealType>(4.53526315786051807494e-2),
  605. static_cast<RealType>(2.44078693689626940834e-2),
  606. static_cast<RealType>(1.52822572478697831870e-3),
  607. static_cast<RealType>(8.69480001029742502197e-4),
  608. };
  609. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  610. }
  611. else {
  612. RealType s = exp(2 * x * x * x / 27) * sqrt(-x);
  613. if (x >= -4) {
  614. RealType t = -x - 2;
  615. // Rational Approximation
  616. // Maximum Relative Error: 2.4768e-18
  617. BOOST_MATH_STATIC const RealType P[8] = {
  618. static_cast<RealType>(2.74308494787955998605e-1),
  619. static_cast<RealType>(4.87765991440983416392e-1),
  620. static_cast<RealType>(3.84524365110270427617e-1),
  621. static_cast<RealType>(1.77409497505926097339e-1),
  622. static_cast<RealType>(5.25612864287310961520e-2),
  623. static_cast<RealType>(1.01528615034079765421e-2),
  624. static_cast<RealType>(1.20417225696161842090e-3),
  625. static_cast<RealType>(6.97462693097107007719e-5),
  626. };
  627. BOOST_MATH_STATIC const RealType Q[8] = {
  628. static_cast<RealType>(1.),
  629. static_cast<RealType>(1.81256903248465876424e0),
  630. static_cast<RealType>(1.43959302060852067876e0),
  631. static_cast<RealType>(6.65882284117861804351e-1),
  632. static_cast<RealType>(1.97537712781845593211e-1),
  633. static_cast<RealType>(3.81732970028510912201e-2),
  634. static_cast<RealType>(4.52767489928026542226e-3),
  635. static_cast<RealType>(2.62240194911920120003e-4),
  636. };
  637. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  638. }
  639. else if (x >= -8) {
  640. RealType t = -x - 4;
  641. // Rational Approximation
  642. // Maximum Relative Error: 1.5741e-17
  643. BOOST_MATH_STATIC const RealType P[8] = {
  644. static_cast<RealType>(2.67391547707456587286e-1),
  645. static_cast<RealType>(3.39319035621314371924e-1),
  646. static_cast<RealType>(1.85434799940724207230e-1),
  647. static_cast<RealType>(5.63667456320679857693e-2),
  648. static_cast<RealType>(1.01231164548944177474e-2),
  649. static_cast<RealType>(1.02501575174439362864e-3),
  650. static_cast<RealType>(4.60769537123286016400e-5),
  651. static_cast<RealType>(-4.92754650783224582641e-13),
  652. };
  653. BOOST_MATH_STATIC const RealType Q[7] = {
  654. static_cast<RealType>(1.),
  655. static_cast<RealType>(1.27271216837333318516e0),
  656. static_cast<RealType>(6.96551952883867277759e-1),
  657. static_cast<RealType>(2.11871363524516350422e-1),
  658. static_cast<RealType>(3.80622887806509632537e-2),
  659. static_cast<RealType>(3.85400280812991562328e-3),
  660. static_cast<RealType>(1.73246593953823694311e-4),
  661. };
  662. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  663. }
  664. else if (x >= -16) {
  665. RealType t = -x - 8;
  666. // Rational Approximation
  667. // Maximum Relative Error: 4.6579e-17
  668. BOOST_MATH_STATIC const RealType P[6] = {
  669. static_cast<RealType>(2.66153901932100301337e-1),
  670. static_cast<RealType>(1.65767350677458230714e-1),
  671. static_cast<RealType>(4.19801402197670061146e-2),
  672. static_cast<RealType>(5.39337995172784579558e-3),
  673. static_cast<RealType>(3.50811247702301287586e-4),
  674. static_cast<RealType>(9.21758454778883157515e-6),
  675. };
  676. BOOST_MATH_STATIC const RealType Q[6] = {
  677. static_cast<RealType>(1.),
  678. static_cast<RealType>(6.23092941554668369107e-1),
  679. static_cast<RealType>(1.57829914506366827914e-1),
  680. static_cast<RealType>(2.02787979758160988615e-2),
  681. static_cast<RealType>(1.31903008994475216511e-3),
  682. static_cast<RealType>(3.46575870637847438219e-5),
  683. };
  684. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  685. }
  686. else if (x >= -32) {
  687. RealType t = -x - 16;
  688. // Rational Approximation
  689. // Maximum Relative Error: 5.2014e-17
  690. BOOST_MATH_STATIC const RealType P[5] = {
  691. static_cast<RealType>(2.65985830928929730672e-1),
  692. static_cast<RealType>(7.19655029633308583205e-2),
  693. static_cast<RealType>(7.26293125679558421946e-3),
  694. static_cast<RealType>(3.24276402295343802262e-4),
  695. static_cast<RealType>(5.40508013573989841127e-6),
  696. };
  697. BOOST_MATH_STATIC const RealType Q[5] = {
  698. static_cast<RealType>(1.),
  699. static_cast<RealType>(2.70578525590448009961e-1),
  700. static_cast<RealType>(2.73082032706004833847e-2),
  701. static_cast<RealType>(1.21926059813954504560e-3),
  702. static_cast<RealType>(2.03227900426552177849e-5),
  703. };
  704. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  705. }
  706. else {
  707. result = 0;
  708. }
  709. }
  710. return result;
  711. }
  712. template <class RealType>
  713. BOOST_MATH_GPU_ENABLED inline RealType mapairy_pdf_minus_imp_prec(const RealType& x, const boost::math::integral_constant<int, 113>&)
  714. {
  715. BOOST_MATH_STD_USING
  716. RealType result;
  717. if (x >= -1) {
  718. RealType t = x + 1;
  719. // Rational Approximation
  720. // Maximum Relative Error: 5.2870e-35
  721. // LCOV_EXCL_START
  722. BOOST_MATH_STATIC const RealType P[14] = {
  723. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.76859868856746781256050397658493368372e-1),
  724. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.13037642242224438972685982606987140111e-1),
  725. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.93206268361082760254653961897373271146e-2),
  726. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.12844418906916902333116398594921450782e-2),
  727. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.36889326770180267250286619759335338794e-3),
  728. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.95272615884641416804001553871108995422e-4),
  729. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.53808638264746233799776679481568171506e-5),
  730. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.92177790427881393122479399837010657693e-6),
  731. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.93492737815019893169693306410980499366e-6),
  732. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.87510085148730083683110532987841223544e-8),
  733. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.28469424017979299382094276157986775969e-9),
  734. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.83693904015623816528442886551032709693e-9),
  735. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.77632857558257155545506847333166147492e-10),
  736. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.00448215148716947837105979735199471601e-11),
  737. };
  738. BOOST_MATH_STATIC const RealType Q[13] = {
  739. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  740. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.69069814466926608209872727645156315374e-1),
  741. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.89657828158127300370734997707096744077e-1),
  742. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.62713433978940724622996782534485162816e-1),
  743. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.91600878366366974062522408704458777166e-2),
  744. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.89144035500328704769924414014440238441e-2),
  745. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.35263616916053275381069097012458200491e-3),
  746. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.49136684724986851824746531490006769036e-3),
  747. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.65912003138912073317982729161392623277e-4),
  748. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.65931144405541620572732754508534372034e-5),
  749. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.40193555853535182510951061797573338442e-6),
  750. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.43625211359756249232841566256877823039e-7),
  751. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.33207781577559817130740123609636060998e-8),
  752. };
  753. // LCOV_EXCL_STOP
  754. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  755. }
  756. else if (x >= -2) {
  757. RealType t = x + 2;
  758. // Rational Approximation
  759. // Maximum Relative Error: 1.1977e-35
  760. // LCOV_EXCL_START
  761. BOOST_MATH_STATIC const RealType P[13] = {
  762. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.14483832832989822788477500521594411868e-1),
  763. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.75657192307644021285091474845448102656e-1),
  764. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.40437358470633234235031852091608646844e-1),
  765. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.66609942512054705023295445270747546208e-2),
  766. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.54563774151184610728476161049657676321e-3),
  767. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.51479057544157089574005315379453615537e-3),
  768. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.59853789372610909788599341307719626846e-4),
  769. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.76919062715142378209907670793921883406e-5),
  770. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.58572738466179822770103948740437237476e-6),
  771. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.66618046393835590932491510543557226290e-7),
  772. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.26253044828460469263564567571249315188e-8),
  773. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.11130363073235247786909976446790746902e-9),
  774. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.49023728251751416730708805268921994420e-10),
  775. };
  776. BOOST_MATH_STATIC const RealType Q[15] = {
  777. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  778. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.11919889346080886194925406930280687022e-1),
  779. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.99082771425048574611745923487528183522e-1),
  780. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.99525320878512488641033584061027063035e-1),
  781. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.20775109959302182467696345673111724657e-2),
  782. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.67505804311611026128557007926613964162e-2),
  783. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.77854913919309273628222660024596583623e-3),
  784. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.91661599559554233157812211199256222756e-3),
  785. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.83924945472605861063053622956144354568e-4),
  786. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.84286353909650034923710426843028632590e-5),
  787. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.57737060659799463556626420070111210218e-5),
  788. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.76047305116625604109657617040360402976e-6),
  789. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.86975509621224474718728318687795215895e-7),
  790. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.71646204381423826495116781730719271111e-8),
  791. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.30359141441663007574346497273327240071e-9),
  792. };
  793. // LCOV_EXCL_STOP
  794. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  795. }
  796. else {
  797. RealType s = exp(2 * x * x * x / 27) * sqrt(-x);
  798. if (x >= -4) {
  799. RealType t = -x - 2;
  800. // Rational Approximation
  801. // Maximum Relative Error: 5.4547e-35
  802. // LCOV_EXCL_START
  803. BOOST_MATH_STATIC const RealType P[15] = {
  804. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.74308494787955998605105974174143750745e-1),
  805. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.56767876568276519015214709629156760546e-1),
  806. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.23402577465454790961498400214198520261e0),
  807. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.09577559351834952074671208183548972395e0),
  808. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.76209118910349927892265971592071407626e-1),
  809. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.09368637728788364895148841703533651597e-1),
  810. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.09003822946777310058789032386408519829e-1),
  811. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.02362804210869367995322279203786166303e-2),
  812. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.67210045349462046966360849113168808620e-3),
  813. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.17170437120510484976042000272825166724e-3),
  814. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.62068279517157268391045945672600042900e-4),
  815. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.72238125522303876741011786930129571553e-5),
  816. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.33906175951716762094473406744654874848e-6),
  817. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.88118741063309731598638313174835288433e-8),
  818. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.78908322579081615215057968216358892954e-9),
  819. };
  820. BOOST_MATH_STATIC const RealType Q[15] = {
  821. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  822. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.15777668058369565739250784347385217839e0),
  823. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.58275582332060589146223977924181161908e0),
  824. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.08890987062755381429904193744273374370e0),
  825. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.53062680969750921573862970262146744660e0),
  826. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.15983695707064161504470525373678920004e0),
  827. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.09120624447001177857109399158887656977e-1),
  828. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.13566107440776375294261717406754395407e-1),
  829. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.50716565210262652091950832287627406780e-2),
  830. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.40417354541359829249609883808591989082e-3),
  831. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.09285589734746898623782466689035549135e-4),
  832. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.47580156629757526370271002425784456931e-5),
  833. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.03479533688660179064728081632921439825e-6),
  834. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.58728676819719406366664644282113323077e-7),
  835. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.72685000369623096389026353785111272994e-9),
  836. };
  837. // LCOV_EXCL_STOP
  838. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  839. }
  840. else if (x >= -8) {
  841. RealType t = -x - 4;
  842. // Rational Approximation
  843. // Maximum Relative Error: 1.8813e-35
  844. // LCOV_EXCL_START
  845. BOOST_MATH_STATIC const RealType P[15] = {
  846. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.67391547707456587286086623414017962238e-1),
  847. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.69944730920904699720804320295067934914e-1),
  848. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.80384452804523880914883464295008532437e-1),
  849. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.74832028145199140240423863864148009059e-1),
  850. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.71728522451977382202061046054643165624e-1),
  851. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.91023495084678296967637417245526177858e-2),
  852. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.57730498044529764612538979048001166775e-2),
  853. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.31940820074475947691746555183209863058e-3),
  854. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.54175805821840981842505041345112198286e-4),
  855. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.31350452337838677820161124238784043790e-5),
  856. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.52175993144502511705213771924810467309e-6),
  857. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.85684239411667243910736588216628677445e-7),
  858. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.27124210379062272403030391492854565008e-8),
  859. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.17645475312219452046348851569796494059e-9),
  860. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.06306499345515479193219487228315566344e-11),
  861. };
  862. BOOST_MATH_STATIC const RealType Q[15] = {
  863. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  864. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.13521398369589479131299586715604029947e0),
  865. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.17680254721938920978999949995837883884e0),
  866. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.40693619288419980101309080614788657638e0),
  867. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.44930162913500531579305526795523256972e-1),
  868. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.22044272115074113804712893993125987243e-1),
  869. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.92745159832354238503828226333417152767e-2),
  870. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.24766164774700476810039401793119553409e-2),
  871. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.08325637569571782180723187639357833929e-3),
  872. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.74954547353553788519997212700557196088e-4),
  873. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.82800744682204649977844278025855329390e-5),
  874. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.20210992299988298543034791887173754015e-6),
  875. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.22996819257926038785424888617824130286e-7),
  876. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.42340212199922656577943251139931264313e-9),
  877. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.75700556749505163188370496864513941614e-11),
  878. };
  879. // LCOV_EXCL_STOP
  880. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  881. }
  882. else if (x >= -16) {
  883. RealType t = -x - 8;
  884. // Rational Approximation
  885. // Maximum Relative Error: 3.7501e-35
  886. // LCOV_EXCL_START
  887. BOOST_MATH_STATIC const RealType P[13] = {
  888. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.66153901932100301337118653561328446399e-1),
  889. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.52542079386371212946566450189144670788e-1),
  890. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.17560936304516198261138159102435548430e-1),
  891. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.26792904240601626330507068992045446428e-2),
  892. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.15418212265160879313643948347460896640e-2),
  893. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.05247220687656529725024232836519908641e-3),
  894. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.64228534097787946289779529645800775231e-4),
  895. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.85634097697132464418223150629017524118e-5),
  896. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.49585420710073223183176764488210189671e-6),
  897. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.48871040740917898530270248991342594461e-7),
  898. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.42577266655992039477272273926475476183e-9),
  899. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.19214263302271253341410568192952269518e-10),
  900. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.36635313919771528255819112450043338510e-12),
  901. };
  902. BOOST_MATH_STATIC const RealType Q[13] = {
  903. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  904. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.32484755553196872705775494679365596205e0),
  905. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.17714315014480774542066462899317631393e-1),
  906. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.10789882607024692577764888497624620277e-1),
  907. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.09821963157449764169644456445120769215e-2),
  908. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.52354198870000121894280965999352991441e-2),
  909. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.12133327236256081067100384182795121111e-3),
  910. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.20187894923874357333806454001674518211e-4),
  911. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.69039238999927049119096278882765161803e-5),
  912. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.35737444680219098802811205475695127060e-7),
  913. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.54403624143647064402264521374546365073e-8),
  914. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.24233005893817070145949404296998119469e-10),
  915. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.89735152971223120087721392400123727326e-12),
  916. };
  917. // LCOV_EXCL_STOP
  918. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  919. }
  920. else if (x >= -32) {
  921. RealType t = -x - 16;
  922. // Rational Approximation
  923. // Maximum Relative Error: 9.2696e-36
  924. // LCOV_EXCL_START
  925. BOOST_MATH_STATIC const RealType P[12] = {
  926. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.65985830928929730672052407058361701971e-1),
  927. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.80409998734303497641108024806388734755e-1),
  928. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.49286120625421787109350223436127409819e-2),
  929. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.89160491404149422833016337592047445082e-3),
  930. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.16725811789351893632348469796802834008e-3),
  931. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.43438517439595919021069131504449842238e-5),
  932. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.29058184637190638359623120253986595623e-6),
  933. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.03288592271246432030980385908922413497e-7),
  934. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.12286831076824535034975676306286388291e-9),
  935. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.64563161552001551475186730009447111173e-11),
  936. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.13183856815615371136129883169639301710e-13),
  937. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.02405342795439598418033139109649640085e-35),
  938. };
  939. BOOST_MATH_STATIC const RealType Q[11] = {
  940. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  941. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.78286317363568496229516074305435186276e-1),
  942. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.06519013547074134846431611115576250187e-1),
  943. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.71907733798006110542919988654989891098e-2),
  944. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.38874744033460851257697736304200953873e-3),
  945. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.54724289412996188575775800547576856966e-4),
  946. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.98922099980447626797646560786207812928e-5),
  947. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.64352676367403443733555974471752023206e-7),
  948. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.92616898324742524009679754162620171773e-8),
  949. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.87471345773127482399498877510153906820e-10),
  950. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.92954174836731254818376396170511443820e-12),
  951. };
  952. // LCOV_EXCL_STOP
  953. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  954. }
  955. else if (x >= -64) {
  956. RealType t = -x - 32;
  957. // Rational Approximation
  958. // Maximum Relative Error: 2.3524e-35
  959. // LCOV_EXCL_START
  960. BOOST_MATH_STATIC const RealType P[10] = {
  961. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.65964563346442080104568381680822923977e-1),
  962. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.77958685324702990033291591478515962894e-2),
  963. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.56419338083136866686699803771820491401e-3),
  964. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.82465178504003399087279098324316458608e-4),
  965. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.92402911374159755476910533154145918079e-5),
  966. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.91224450962405933321548581824712789516e-7),
  967. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.84063939469145970625490205194192347630e-9),
  968. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.15300528698702940691774461674788639801e-11),
  969. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.85553643603397817535280932672322232325e-13),
  970. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.46207029637607033398822620480584537642e-38),
  971. };
  972. BOOST_MATH_STATIC const RealType Q[9] = {
  973. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  974. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.54906717312241693103173902792310528801e-1),
  975. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.84408124581401290943345932332007045483e-2),
  976. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.81403744024723164669745491417804917709e-3),
  977. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.23423244618880845765135047598258754409e-5),
  978. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.84697524433421334697753031272973192290e-6),
  979. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.94803525968789587050040294764458613062e-8),
  980. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.68948879514200831687856703804327184420e-10),
  981. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.07366525547027105672618224029122809899e-12),
  982. };
  983. // LCOV_EXCL_STOP
  984. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  985. }
  986. else {
  987. result = 0;
  988. }
  989. }
  990. return result;
  991. }
  992. template <class RealType>
  993. BOOST_MATH_GPU_ENABLED inline RealType mapairy_pdf_imp_prec(const RealType& x, const boost::math::integral_constant<int, 53> &tag) {
  994. if (x >= 0) {
  995. return mapairy_pdf_plus_imp_prec<RealType>(x, tag);
  996. }
  997. else if (x <= 0) {
  998. return mapairy_pdf_minus_imp_prec<RealType>(x, tag);
  999. }
  1000. else {
  1001. return boost::math::numeric_limits<RealType>::quiet_NaN();
  1002. }
  1003. }
  1004. template <class RealType>
  1005. BOOST_MATH_GPU_ENABLED inline RealType mapairy_pdf_imp_prec(const RealType& x, const boost::math::integral_constant<int, 113>& tag) {
  1006. if (x >= 0) {
  1007. return mapairy_pdf_plus_imp_prec<RealType>(x, tag);
  1008. }
  1009. else if (x <= 0) {
  1010. return mapairy_pdf_minus_imp_prec<RealType>(x, tag);
  1011. }
  1012. else {
  1013. return boost::math::numeric_limits<RealType>::quiet_NaN();
  1014. }
  1015. }
  1016. template <class RealType, class Policy>
  1017. BOOST_MATH_GPU_ENABLED inline RealType mapairy_pdf_imp(const mapairy_distribution<RealType, Policy>& dist, const RealType& x) {
  1018. //
  1019. // This calculates the pdf of the Map-Airy distribution and/or its complement.
  1020. //
  1021. BOOST_MATH_STD_USING // for ADL of std functions
  1022. constexpr auto function = "boost::math::pdf(mapairy<%1%>&, %1%)";
  1023. RealType result = 0;
  1024. RealType location = dist.location();
  1025. RealType scale = dist.scale();
  1026. if (false == detail::check_location(function, location, &result, Policy()))
  1027. {
  1028. return result;
  1029. }
  1030. if (false == detail::check_scale(function, scale, &result, Policy()))
  1031. {
  1032. return result;
  1033. }
  1034. if (false == detail::check_x(function, x, &result, Policy()))
  1035. {
  1036. return result;
  1037. }
  1038. typedef typename tools::promote_args<RealType>::type result_type;
  1039. typedef typename policies::precision<result_type, Policy>::type precision_type;
  1040. typedef boost::math::integral_constant<int,
  1041. precision_type::value <= 0 ? 0 :
  1042. precision_type::value <= 53 ? 53 :
  1043. precision_type::value <= 113 ? 113 : 0
  1044. > tag_type;
  1045. static_assert(tag_type::value, "The Map-Airy distribution is only implemented for types with known precision, and 113 bits or fewer in the mantissa (ie 128 bit quad-floats");
  1046. RealType u = (x - location) / scale;
  1047. result = mapairy_pdf_imp_prec(u, tag_type()) / scale;
  1048. return result;
  1049. }
  1050. template <class RealType>
  1051. BOOST_MATH_GPU_ENABLED inline RealType mapairy_cdf_plus_imp_prec(const RealType& x, const boost::math::integral_constant<int, 53>&)
  1052. {
  1053. BOOST_MATH_STD_USING
  1054. RealType result;
  1055. if (x < 1) {
  1056. // Rational Approximation
  1057. // Maximum Relative Error: 2.9194e-17
  1058. BOOST_MATH_STATIC const RealType P[7] = {
  1059. static_cast<RealType>(3.33333333333333333333e-1),
  1060. static_cast<RealType>(7.49532137610545010591e-2),
  1061. static_cast<RealType>(9.25326921848155048716e-3),
  1062. static_cast<RealType>(6.59133092365796208900e-3),
  1063. static_cast<RealType>(-5.21942678326323374113e-4),
  1064. static_cast<RealType>(8.22766804917461941348e-5),
  1065. static_cast<RealType>(-3.97941251650023182117e-6),
  1066. };
  1067. BOOST_MATH_STATIC const RealType Q[7] = {
  1068. static_cast<RealType>(1.),
  1069. static_cast<RealType>(8.17408156824742736411e-1),
  1070. static_cast<RealType>(3.57041011418415988268e-1),
  1071. static_cast<RealType>(1.04580353775369716002e-1),
  1072. static_cast<RealType>(1.87521616934129432292e-2),
  1073. static_cast<RealType>(2.33232161135637085535e-3),
  1074. static_cast<RealType>(7.31285352607895467310e-5),
  1075. };
  1076. result = tools::evaluate_polynomial(P, x) / tools::evaluate_polynomial(Q, x);
  1077. }
  1078. else if (x < 2) {
  1079. RealType t = x - 1;
  1080. // Rational Approximation
  1081. // Maximum Relative Error: 3.1531e-17
  1082. BOOST_MATH_STATIC const RealType P[7] = {
  1083. static_cast<RealType>(1.84196970581015939888e-1),
  1084. static_cast<RealType>(-1.19398028299089933853e-3),
  1085. static_cast<RealType>(1.21954054797949597854e-2),
  1086. static_cast<RealType>(-9.37912675685073154845e-4),
  1087. static_cast<RealType>(1.66651954077980453212e-4),
  1088. static_cast<RealType>(-1.33271812303025233648e-5),
  1089. static_cast<RealType>(5.35982226125013888796e-7),
  1090. };
  1091. BOOST_MATH_STATIC const RealType Q[6] = {
  1092. static_cast<RealType>(1.),
  1093. static_cast<RealType>(5.70352826101668448273e-1),
  1094. static_cast<RealType>(1.98852010141232271304e-1),
  1095. static_cast<RealType>(3.64864882318453496161e-2),
  1096. static_cast<RealType>(4.22173125405065522298e-3),
  1097. static_cast<RealType>(1.20079284386796600356e-4),
  1098. };
  1099. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1100. }
  1101. else if (x < 4) {
  1102. RealType t = x - 2;
  1103. // Rational Approximation
  1104. // Maximum Relative Error: 1.8348e-17
  1105. BOOST_MATH_STATIC const RealType P[8] = {
  1106. static_cast<RealType>(1.07409273397524124098e-1),
  1107. static_cast<RealType>(3.83900318969331880402e-2),
  1108. static_cast<RealType>(1.17926652359826576790e-2),
  1109. static_cast<RealType>(1.52181625871479030046e-3),
  1110. static_cast<RealType>(1.50703424417132565662e-4),
  1111. static_cast<RealType>(2.10117959279448106308e-6),
  1112. static_cast<RealType>(1.97360985832285866640e-8),
  1113. static_cast<RealType>(-1.06076300080048408251e-9),
  1114. };
  1115. BOOST_MATH_STATIC const RealType Q[7] = {
  1116. static_cast<RealType>(1.),
  1117. static_cast<RealType>(8.54435380513870673497e-1),
  1118. static_cast<RealType>(3.66021233157880878411e-1),
  1119. static_cast<RealType>(9.42985570806905160687e-2),
  1120. static_cast<RealType>(1.54122343653998564507e-2),
  1121. static_cast<RealType>(1.49849056258932455548e-3),
  1122. static_cast<RealType>(6.94290406268856211707e-5),
  1123. };
  1124. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1125. }
  1126. else if (x < 8) {
  1127. RealType t = x - 4;
  1128. // Rational Approximation
  1129. // Maximum Relative Error: 2.6624e-18
  1130. BOOST_MATH_STATIC const RealType P[8] = {
  1131. static_cast<RealType>(4.70720199535228802538e-2),
  1132. static_cast<RealType>(2.67200763833749070079e-2),
  1133. static_cast<RealType>(7.37400551855064729769e-3),
  1134. static_cast<RealType>(1.10592441765001623699e-3),
  1135. static_cast<RealType>(9.15846028547400212588e-5),
  1136. static_cast<RealType>(3.17801522553862136789e-6),
  1137. static_cast<RealType>(2.03102753319827713542e-8),
  1138. static_cast<RealType>(-5.16172854149066643529e-11),
  1139. };
  1140. BOOST_MATH_STATIC const RealType Q[8] = {
  1141. static_cast<RealType>(1.),
  1142. static_cast<RealType>(9.05317644829451086870e-1),
  1143. static_cast<RealType>(3.73713496637025562492e-1),
  1144. static_cast<RealType>(8.94434672792094976627e-2),
  1145. static_cast<RealType>(1.31846542255347106087e-2),
  1146. static_cast<RealType>(1.16680596342421447100e-3),
  1147. static_cast<RealType>(5.44719256441278863300e-5),
  1148. static_cast<RealType>(8.73131209154185067287e-7),
  1149. };
  1150. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1151. }
  1152. else if (x < 16) {
  1153. RealType t = x - 8;
  1154. // Rational Approximation
  1155. // Maximum Relative Error: 2.6243e-17
  1156. BOOST_MATH_STATIC const RealType P[8] = {
  1157. static_cast<RealType>(1.74847564444513000450e-2),
  1158. static_cast<RealType>(6.00209162595027323742e-3),
  1159. static_cast<RealType>(7.86550260761375576075e-4),
  1160. static_cast<RealType>(4.46682547335758521734e-5),
  1161. static_cast<RealType>(9.51329761417139273391e-7),
  1162. static_cast<RealType>(4.10313065114362712333e-9),
  1163. static_cast<RealType>(-9.81286503831545640189e-12),
  1164. static_cast<RealType>(2.98763969872672156104e-14),
  1165. };
  1166. BOOST_MATH_STATIC const RealType Q[7] = {
  1167. static_cast<RealType>(1.),
  1168. static_cast<RealType>(5.27732094554221674504e-1),
  1169. static_cast<RealType>(1.14330643482604301178e-1),
  1170. static_cast<RealType>(1.27722341942374066265e-2),
  1171. static_cast<RealType>(7.54563340152441778517e-4),
  1172. static_cast<RealType>(2.13377039814057925832e-5),
  1173. static_cast<RealType>(2.09670987094350618690e-7),
  1174. };
  1175. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1176. }
  1177. else if (x < 32) {
  1178. RealType t = x - 16;
  1179. // Rational Approximation
  1180. // Maximum Relative Error: 5.4684e-17
  1181. BOOST_MATH_STATIC const RealType P[8] = {
  1182. static_cast<RealType>(6.22684103170563193015e-3),
  1183. static_cast<RealType>(1.34714356588780958096e-3),
  1184. static_cast<RealType>(9.51289465377874891896e-5),
  1185. static_cast<RealType>(2.64918464474843134081e-6),
  1186. static_cast<RealType>(2.66703857491046795285e-8),
  1187. static_cast<RealType>(5.42037888457985833156e-11),
  1188. static_cast<RealType>(-6.18017115447736427379e-14),
  1189. static_cast<RealType>(9.11626234402148561268e-17),
  1190. };
  1191. BOOST_MATH_STATIC const RealType Q[7] = {
  1192. static_cast<RealType>(1.),
  1193. static_cast<RealType>(3.09895694991285975774e-1),
  1194. static_cast<RealType>(3.69874670435930773471e-2),
  1195. static_cast<RealType>(2.15708854325146400153e-3),
  1196. static_cast<RealType>(6.35345408451056881884e-5),
  1197. static_cast<RealType>(8.65722805575670770555e-7),
  1198. static_cast<RealType>(4.03153189557220023202e-9),
  1199. };
  1200. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1201. }
  1202. else if (x < 64) {
  1203. RealType t = x - 32;
  1204. // Rational Approximation
  1205. // Maximum Relative Error: 6.5947e-17
  1206. BOOST_MATH_STATIC const RealType P[7] = {
  1207. static_cast<RealType>(2.20357145727036120652e-3),
  1208. static_cast<RealType>(1.45412555771401325111e-4),
  1209. static_cast<RealType>(3.27819006009093198652e-6),
  1210. static_cast<RealType>(2.96786786716623870006e-8),
  1211. static_cast<RealType>(9.54192199129339742308e-11),
  1212. static_cast<RealType>(5.71421706870777687254e-14),
  1213. static_cast<RealType>(-1.48321866072033823195e-17),
  1214. };
  1215. BOOST_MATH_STATIC const RealType Q[7] = {
  1216. static_cast<RealType>(1.),
  1217. static_cast<RealType>(1.12851983233980279746e-1),
  1218. static_cast<RealType>(4.94650928817638043712e-3),
  1219. static_cast<RealType>(1.05447405092956497114e-4),
  1220. static_cast<RealType>(1.11578464291338271178e-6),
  1221. static_cast<RealType>(5.27522295397347842625e-9),
  1222. static_cast<RealType>(7.95786524903707645399e-12),
  1223. };
  1224. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1225. }
  1226. else {
  1227. RealType x_cube = x * x * x;
  1228. RealType t = static_cast<RealType>((boost::math::isnormal)(x_cube) ? 1 / sqrt(x_cube) : 1 / pow(sqrt(x), 3));
  1229. // Rational Approximation
  1230. // Maximum Relative Error: 6.2709e-17
  1231. BOOST_MATH_STATIC const RealType P[4] = {
  1232. static_cast<RealType>(3.98942280401432677940e-1),
  1233. static_cast<RealType>(2.89752186412133782995e-2),
  1234. static_cast<RealType>(4.67360459917040710474e0),
  1235. static_cast<RealType>(-1.26770824563800250704e-1),
  1236. };
  1237. BOOST_MATH_STATIC const RealType Q[3] = {
  1238. static_cast<RealType>(1.),
  1239. static_cast<RealType>(7.26301023103568827709e-2),
  1240. static_cast<RealType>(1.60899894281099149848e1),
  1241. };
  1242. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t) * t;
  1243. }
  1244. return result;
  1245. }
  1246. template <class RealType>
  1247. BOOST_MATH_GPU_ENABLED inline RealType mapairy_cdf_plus_imp_prec(const RealType& x, const boost::math::integral_constant<int, 113>&)
  1248. {
  1249. BOOST_MATH_STD_USING
  1250. RealType result;
  1251. if (x < 1) {
  1252. // Rational Approximation
  1253. // Maximum Relative Error: 4.7720e-37
  1254. // LCOV_EXCL_START
  1255. BOOST_MATH_STATIC const RealType P[14] = {
  1256. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.33333333333333333333333333333333333333e-1),
  1257. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.38519736580901276671338330967060054188e-1),
  1258. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.07012342772403725079487012557507575976e-2),
  1259. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.70163612228825567572185033570526547856e-2),
  1260. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.16393313438726572630782132625753922397e-3),
  1261. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.92141312947853945617138019222992750592e-4),
  1262. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.16513062047959961711747864068554379374e-4),
  1263. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.08850391017085844154857927364247623649e-5),
  1264. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.07060872491334153829857156707699441084e-6),
  1265. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.56961733740920438026573722084839596926e-8),
  1266. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.93626747947476815631021107726714283086e-10),
  1267. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.32967164823609209711923411113824666288e-10),
  1268. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.23420723211833268177898025846064230665e-12),
  1269. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.13807083548358335699029971528179486964e-13),
  1270. };
  1271. BOOST_MATH_STATIC const RealType Q[12] = {
  1272. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1273. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.00810772528427939684296334977783425582e0),
  1274. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.24383652800043768524894854013745098654e-1),
  1275. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.64696616559657052516796844068580626381e-1),
  1276. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.62288747679271039067363492752820355369e-2),
  1277. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.19311779292286492714550084942827207241e-2),
  1278. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.48436879303839576521077892946281025894e-3),
  1279. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.28665316157256311138787387605249076674e-4),
  1280. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.36350302380845433472593647100484547496e-5),
  1281. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.05835458213330488018147374864403662878e-6),
  1282. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.13919959493955187399856105325181806876e-7),
  1283. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.30960533107704070411766556906543316310e-8),
  1284. };
  1285. // LCOV_EXCL_STOP
  1286. result = tools::evaluate_polynomial(P, x) / tools::evaluate_polynomial(Q, x);
  1287. }
  1288. else if (x < 2) {
  1289. RealType t = x - 1;
  1290. // Rational Approximation
  1291. // Maximum Relative Error: 1.6297e-35
  1292. // LCOV_EXCL_START
  1293. BOOST_MATH_STATIC const RealType P[13] = {
  1294. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.84196970581015939887507434989936103587e-1),
  1295. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.23864910443500344832158256856064580005e-1),
  1296. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.72066675347648126090497588433854314742e-2),
  1297. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.81712740200456564860442639192891089515e-2),
  1298. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.39091197181834765859741334477680768031e-3),
  1299. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.03759464781707198959689175957603165395e-4),
  1300. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.15298069568149410830642785868857309358e-4),
  1301. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.18910514301176322829267019223946392192e-5),
  1302. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.16851691488007921400221017970691227149e-7),
  1303. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.82031940093536875619655849638573432722e-8),
  1304. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.30042143299959913519747484877532997335e-10),
  1305. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.19848671456872291336347012756651759817e-11),
  1306. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.00479393063394570750334218362674723065e-13),
  1307. };
  1308. BOOST_MATH_STATIC const RealType Q[12] = {
  1309. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1310. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.24929390929112144560152115661603117364e0),
  1311. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.34853762543033883106055186520573363290e-1),
  1312. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.73783624941936412984356492130276742707e-1),
  1313. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.23224734370942016023173307854505597524e-1),
  1314. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.11116448823067697039703254343621931158e-2),
  1315. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.12490054037308798338231679733816982120e-3),
  1316. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.38701607014856856812627276285445001885e-4),
  1317. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.10075199231657382435402462616587005087e-4),
  1318. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.43662615015322880941108094510531477066e-6),
  1319. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.37981396630189761210639158952200945512e-7),
  1320. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.55820444854396304928946970937054949160e-8),
  1321. };
  1322. // LCOV_EXCL_STOP
  1323. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1324. }
  1325. else if (x < 4) {
  1326. RealType t = x - 2;
  1327. // Rational Approximation
  1328. // Maximum Relative Error: 2.8103e-36
  1329. // LCOV_EXCL_START
  1330. BOOST_MATH_STATIC const RealType P[14] = {
  1331. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.07409273397524124098315500450332255837e-1),
  1332. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.98373054365213259465522536994638631699e-2),
  1333. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.30851284606709136235419547406278197945e-2),
  1334. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.92686617543233900289721448026065555990e-2),
  1335. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.18056394312484073294780140350522772329e-3),
  1336. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.07058343449035366484618967963264380933e-3),
  1337. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.71636108080692802684712497501670425230e-4),
  1338. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.13155853034615230731719317488499751231e-5),
  1339. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.00070273388376168880473457782396672044e-6),
  1340. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.35528857373910910704625837069445190727e-7),
  1341. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.99897218751541535347315078577172104436e-9),
  1342. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.35092090729912631973050415647154137571e-10),
  1343. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.72220647682193638971237255396233171508e-13),
  1344. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.45008884108655511268690849420714428764e-15),
  1345. };
  1346. BOOST_MATH_STATIC const RealType Q[14] = {
  1347. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1348. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.42652074703683973183213296310906006173e0),
  1349. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.03479786698331153607905223548719296572e0),
  1350. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.95556520914240562719970700900964416000e-1),
  1351. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.73127917601685318803655745157828471269e-1),
  1352. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.63007065833918179119250623000791647836e-2),
  1353. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.70652732923091039268400927316918354628e-3),
  1354. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.60880782675229297981880241245777122866e-3),
  1355. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.09979261868403910549978204036056659380e-4),
  1356. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.12085610111710889118562321318284539217e-5),
  1357. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.59811533082647193392924345081953134304e-6),
  1358. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.37211668706684650035086116219257276925e-8),
  1359. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.62479830409039340826066305367893543134e-9),
  1360. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.22039803134898937546371285610102850458e-11),
  1361. };
  1362. // LCOV_EXCL_STOP
  1363. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1364. }
  1365. else if (x < 8) {
  1366. RealType t = x - 4;
  1367. // Rational Approximation
  1368. // Maximum Relative Error: 7.5930e-35
  1369. // LCOV_EXCL_START
  1370. BOOST_MATH_STATIC const RealType P[14] = {
  1371. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.70720199535228802537946089633331273434e-2),
  1372. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.85220706158476482443562698303252970927e-2),
  1373. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.55090221054465759649629178911450010833e-2),
  1374. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.70398047783095186291450019612979853708e-3),
  1375. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.11846661331973171721224034349719801691e-3),
  1376. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.83195024406409870789088752469490824640e-4),
  1377. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.23908312140480103249294791529383548724e-5),
  1378. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.40765128885655152415228193255890859830e-6),
  1379. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.14294523267278070539100529759317560119e-7),
  1380. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.26815059429007745850376987481747435820e-8),
  1381. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.28142945635159623618312928455133399240e-10),
  1382. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.77079683180868753715374495747422819326e-11),
  1383. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.73710011278079325323578951018770847628e-13),
  1384. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.70140037580287364298206334732060874507e-16),
  1385. };
  1386. BOOST_MATH_STATIC const RealType Q[16] = {
  1387. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1388. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.36848014038411798213992770858203510748e0),
  1389. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.15373052017549822413011375404872359177e-1),
  1390. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.92705544967513282963463451395766172671e-1),
  1391. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19899290805598090502434290420047460406e-1),
  1392. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.74002906913724742582773116667380578990e-2),
  1393. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.80632456977494447641985312297971970632e-3),
  1394. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.53381530665983535467406445749348183915e-4),
  1395. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.86606180756179817016240556949228031340e-5),
  1396. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.49594666942152749850479792402078560469e-6),
  1397. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.25231012522695972983928740617341887334e-7),
  1398. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.34987086926725472733984045599487947378e-8),
  1399. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.58286136970918021841189712851698747417e-10),
  1400. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.12238357666199366902936267515573231037e-12),
  1401. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.82464168044335183356132979380360583444e-14),
  1402. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.40073718480172265670072434562833527076e-17),
  1403. };
  1404. // LCOV_EXCL_STOP
  1405. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1406. }
  1407. else if (x < 16) {
  1408. RealType t = x - 8;
  1409. // Rational Approximation
  1410. // Maximum Relative Error: 7.3609e-35
  1411. // LCOV_EXCL_START
  1412. BOOST_MATH_STATIC const RealType P[16] = {
  1413. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.74847564444513000450056174922427854591e-2),
  1414. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.56842503159303803254436983444304764079e-2),
  1415. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.48504629497687889354406208309334148575e-3),
  1416. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.62327083507366120871877936416427790391e-3),
  1417. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.72062210557023828776202679230979309963e-4),
  1418. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.19153025667221102770398900522196418041e-5),
  1419. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.66248482185063262034022017727375829162e-6),
  1420. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.57390218395059632327421809878050974588e-7),
  1421. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.45520328522839835737631604118833792570e-9),
  1422. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.76327978880339919462910339138428389322e-10),
  1423. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.99700625463451418394515481232159889297e-12),
  1424. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.82943476668680389338853032002472541164e-14),
  1425. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19415284760817575957617090798914089413e-16),
  1426. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.17080879333540200065368097274334363537e-19),
  1427. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.09912208206107606750610288716869139753e-23),
  1428. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.98451733054622166748935243139556132704e-26),
  1429. };
  1430. BOOST_MATH_STATIC const RealType Q[15] = {
  1431. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1432. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.08148065380582488495702136465010348576e0),
  1433. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.42385352331252779422725444021027377277e-1),
  1434. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.66510412535270623169792008730183916611e-1),
  1435. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.47952712144801508762945315513819636452e-2),
  1436. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.20703092334999244212988997416711617790e-3),
  1437. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.71658889250345012472529115544710926154e-4),
  1438. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.63905601023452497974798277091285373919e-5),
  1439. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.76730409484335386334980429532443217982e-6),
  1440. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19139408077753398896224794522985050607e-7),
  1441. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.58025872548387600940275201648443410419e-9),
  1442. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.11369336267349152895272975096509109414e-11),
  1443. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.56182954522937999103610817174373785571e-13),
  1444. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.35452907177197742692545044913125982311e-15),
  1445. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.23587924912460218189929226092439805175e-17),
  1446. };
  1447. // LCOV_EXCL_STOP
  1448. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1449. }
  1450. else if (x < 32) {
  1451. RealType t = x - 16;
  1452. // Rational Approximation
  1453. // Maximum Relative Error: 9.7192e-35
  1454. // LCOV_EXCL_START
  1455. BOOST_MATH_STATIC const RealType P[15] = {
  1456. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.22684103170563193014558918295924551173e-3),
  1457. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.55222688816852408105912768186300290291e-3),
  1458. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.60747505331765587662432023547517953629e-4),
  1459. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.80463770266821887100086895337451846880e-5),
  1460. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.19190824169154471000496746227725070963e-6),
  1461. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.40646301571395681364881852739555404287e-7),
  1462. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.15408836734496798091749932018121879724e-9),
  1463. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.13676779930022341958128426888835497781e-11),
  1464. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.02435098103190516418351075792372986932e-12),
  1465. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.82018920071479061978244972592746216377e-15),
  1466. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.26435061215428679536159320644587957335e-17),
  1467. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.05298407883178633891153989998582851270e-20),
  1468. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.61156860101928352010449210760843428372e-23),
  1469. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.02156808288545876198121127510075217184e-27),
  1470. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.65549196385656698597261688277898043367e-30),
  1471. };
  1472. BOOST_MATH_STATIC const RealType Q[14] = {
  1473. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1474. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.03426141030409708635168766288764563749e-1),
  1475. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.13808987755928828118915442251025992769e-1),
  1476. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.52253239792170999949444502938290297674e-2),
  1477. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.33720936468171204432499390745432338841e-3),
  1478. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.08713980159883984886576124842631646880e-5),
  1479. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.43652846144339754840998823540656399165e-6),
  1480. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.02849693617024492825330133490278326951e-7),
  1481. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.14110017452008167954262319462808192536e-9),
  1482. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.01462578814695350559338360744897649915e-11),
  1483. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.73495817568046489613308117490508832084e-13),
  1484. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.47445372925844096612021093857581987132e-15),
  1485. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.08200002287534174751275097848899176785e-18),
  1486. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.15305756373406702253187385797525419287e-21),
  1487. };
  1488. // LCOV_EXCL_STOP
  1489. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1490. }
  1491. else if (x < 64) {
  1492. RealType t = x - 32;
  1493. // Rational Approximation
  1494. // Maximum Relative Error: 9.7799e-35
  1495. // LCOV_EXCL_START
  1496. BOOST_MATH_STATIC const RealType P[13] = {
  1497. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.20357145727036120652264700679701054983e-3),
  1498. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.95712324967981162396595365933255312698e-4),
  1499. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.08619492652809635942960438372427086939e-5),
  1500. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.37140224583881547818087260161723208444e-6),
  1501. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.83073777522092069988595553041062506001e-8),
  1502. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.00473542739040742110568810201412321512e-10),
  1503. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.47447289601822506789553624164171452120e-12),
  1504. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.70913574957198131397471307249294758738e-14),
  1505. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.36538119628489354953085829178695645929e-16),
  1506. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.00763343664814257170332492241110173166e-18),
  1507. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.62297585950798764290583627210836077239e-21),
  1508. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.15780217054514513493147192853488153246e-24),
  1509. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.31961589164397397724611386366339562789e-28),
  1510. };
  1511. BOOST_MATH_STATIC const RealType Q[15] = {
  1512. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1513. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.26440207646105117747875545474828367516e-1),
  1514. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.27872879091838733280518786463281413334e-2),
  1515. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.34256572873114675776148923422025029494e-3),
  1516. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.13595637397535037957995766856628205747e-5),
  1517. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.33745879863685053883024090247009549434e-6),
  1518. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.41792226523670940279016788831933559977e-8),
  1519. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.03966147662273388060545199475024100492e-10),
  1520. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.62177951640260313354050335795080248910e-12),
  1521. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.50650165210517365082118441264513277196e-14),
  1522. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.48413283257020741389298806290302772976e-17),
  1523. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.16439276222123152748426700489921412654e-19),
  1524. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.24969602890963356175782126478237865639e-22),
  1525. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.08681155203261739689727004641345513984e-26),
  1526. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.28282024196484688479115133027874255367e-30),
  1527. };
  1528. // LCOV_EXCL_STOP
  1529. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1530. }
  1531. else {
  1532. RealType x_cube = x * x * x;
  1533. RealType t = (boost::math::isnormal)(x_cube) ? 1 / sqrt(x_cube) : 1 / pow(sqrt(x), 3);
  1534. // Rational Approximation
  1535. // Maximum Relative Error: 3.5865e-37
  1536. // LCOV_EXCL_START
  1537. BOOST_MATH_STATIC const RealType P[8] = {
  1538. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.98942280401432677939946059934381868476e-1),
  1539. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.12426566605292130233061857505057433291e-1),
  1540. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.91574528280329492283287073127040983832e1),
  1541. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.69914217884224943794012165979483573091e1),
  1542. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.30178902028403564086640591437738216288e3),
  1543. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.96515490341559353794378324810127583810e2),
  1544. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.44343825578434751356083230369361399507e3),
  1545. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.07224810408790092272497403739984510394e2),
  1546. };
  1547. BOOST_MATH_STATIC const RealType Q[7] = {
  1548. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1549. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.32474438135610721926278423612948794250e-1),
  1550. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.27594461167587027771303292526448542806e2),
  1551. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.49207539478843628626934249487055017677e1),
  1552. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.75094412095634602055738687636893575929e3),
  1553. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.51642534474780515366628648516673270623e2),
  1554. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.05977615003758056284424652420774587813e4),
  1555. };
  1556. // LCOV_EXCL_STOP
  1557. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t) * t;
  1558. }
  1559. return result;
  1560. }
  1561. template <class RealType>
  1562. BOOST_MATH_GPU_ENABLED inline RealType mapairy_cdf_minus_imp_prec(const RealType& x, const boost::math::integral_constant<int, 53>&)
  1563. {
  1564. BOOST_MATH_STD_USING
  1565. RealType result;
  1566. if (x >= -1) {
  1567. RealType t = x + 1;
  1568. // Rational Approximation
  1569. // Maximum Relative Error: 1.6964e-18
  1570. BOOST_MATH_STATIC const RealType P[8] = {
  1571. static_cast<RealType>(4.23238998449671083670e-1),
  1572. static_cast<RealType>(4.95353582976475183891e-1),
  1573. static_cast<RealType>(2.45823281826037784270e-1),
  1574. static_cast<RealType>(7.29726507468813920788e-2),
  1575. static_cast<RealType>(1.63332856186819713346e-2),
  1576. static_cast<RealType>(2.82514634871307516142e-3),
  1577. static_cast<RealType>(2.66220579589280704089e-4),
  1578. static_cast<RealType>(3.09442180091323751049e-6),
  1579. };
  1580. BOOST_MATH_STATIC const RealType Q[7] = {
  1581. static_cast<RealType>(1.),
  1582. static_cast<RealType>(5.16241922223786900600e-1),
  1583. static_cast<RealType>(2.75690727171711638879e-1),
  1584. static_cast<RealType>(7.18707184893542884080e-2),
  1585. static_cast<RealType>(1.87136800286819336797e-2),
  1586. static_cast<RealType>(2.38383441176345054929e-3),
  1587. static_cast<RealType>(3.23509126477812051983e-4),
  1588. };
  1589. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1590. }
  1591. else if (x >= -2) {
  1592. RealType t = x + 2;
  1593. // Rational Approximation
  1594. // Maximum Relative Error: 5.8303e-17
  1595. BOOST_MATH_STATIC const RealType P[8] = {
  1596. static_cast<RealType>(1.62598955251978523175e-1),
  1597. static_cast<RealType>(2.30154661502402196205e-1),
  1598. static_cast<RealType>(1.29233975368291684522e-1),
  1599. static_cast<RealType>(3.80919553916980965587e-2),
  1600. static_cast<RealType>(8.17724414618808505948e-3),
  1601. static_cast<RealType>(1.95816800210481122544e-3),
  1602. static_cast<RealType>(3.35259917978421935141e-4),
  1603. static_cast<RealType>(1.22071311320012805777e-5),
  1604. };
  1605. BOOST_MATH_STATIC const RealType Q[7] = {
  1606. static_cast<RealType>(1.),
  1607. static_cast<RealType>(9.63771793313770952352e-2),
  1608. static_cast<RealType>(2.23602260938227310054e-1),
  1609. static_cast<RealType>(9.21944797677283179038e-3),
  1610. static_cast<RealType>(1.82181136341939651516e-2),
  1611. static_cast<RealType>(1.11216849284965970458e-4),
  1612. static_cast<RealType>(5.57446347676836375810e-4),
  1613. };
  1614. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1615. }
  1616. else {
  1617. RealType s = exp(2 * x * x * x / 27) / sqrt(-x * x * x);
  1618. if (x >= -4) {
  1619. RealType t = -x - 2;
  1620. // Rational Approximation
  1621. // Maximum Relative Error: 3.6017e-18
  1622. BOOST_MATH_STATIC const RealType P[8] = {
  1623. static_cast<RealType>(8.31806744221966404520e-1),
  1624. static_cast<RealType>(1.34481067378012055850e0),
  1625. static_cast<RealType>(9.12139427469494995264e-1),
  1626. static_cast<RealType>(3.59706159222491124928e-1),
  1627. static_cast<RealType>(9.48836332725688279299e-2),
  1628. static_cast<RealType>(1.68259594978853951234e-2),
  1629. static_cast<RealType>(1.89700733471520162946e-3),
  1630. static_cast<RealType>(1.13854052826846329787e-4),
  1631. };
  1632. BOOST_MATH_STATIC const RealType Q[8] = {
  1633. static_cast<RealType>(1.),
  1634. static_cast<RealType>(1.29694286517571741097e0),
  1635. static_cast<RealType>(7.99686735441213882518e-1),
  1636. static_cast<RealType>(3.08198207583883597188e-1),
  1637. static_cast<RealType>(7.97230139795658588972e-2),
  1638. static_cast<RealType>(1.40742142048849462162e-2),
  1639. static_cast<RealType>(1.58411440546277691506e-3),
  1640. static_cast<RealType>(9.51560785730564046338e-5),
  1641. };
  1642. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1643. }
  1644. else if (x >= -8) {
  1645. RealType t = -x - 4;
  1646. // Rational Approximation
  1647. // Maximum Relative Error: 1.3504e-17
  1648. BOOST_MATH_STATIC const RealType P[8] = {
  1649. static_cast<RealType>(1.10294551528734705946e0),
  1650. static_cast<RealType>(1.26696377028973554615e0),
  1651. static_cast<RealType>(6.63115985833429688941e-1),
  1652. static_cast<RealType>(2.06289793717379095832e-1),
  1653. static_cast<RealType>(4.11977615717846276227e-2),
  1654. static_cast<RealType>(5.28620928618550859827e-3),
  1655. static_cast<RealType>(4.04328442334023561279e-4),
  1656. static_cast<RealType>(1.42364413902075896503e-5),
  1657. };
  1658. BOOST_MATH_STATIC const RealType Q[8] = {
  1659. static_cast<RealType>(1.),
  1660. static_cast<RealType>(1.09709853682665798542e0),
  1661. static_cast<RealType>(5.63687797989627787500e-1),
  1662. static_cast<RealType>(1.73604358560002859604e-1),
  1663. static_cast<RealType>(3.44985744385890794044e-2),
  1664. static_cast<RealType>(4.41683993064797272821e-3),
  1665. static_cast<RealType>(3.37834206192286709492e-4),
  1666. static_cast<RealType>(1.18951465786445720729e-5),
  1667. };
  1668. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1669. }
  1670. else if (x >= -16) {
  1671. RealType t = -x - 8;
  1672. // Rational Approximation
  1673. // Maximum Relative Error: 8.8272e-18
  1674. BOOST_MATH_STATIC const RealType P[7] = {
  1675. static_cast<RealType>(1.18246847255744057280e0),
  1676. static_cast<RealType>(8.41320657699741240497e-1),
  1677. static_cast<RealType>(2.55093097377551881478e-1),
  1678. static_cast<RealType>(4.21261576802732715976e-2),
  1679. static_cast<RealType>(3.98805044659990523312e-3),
  1680. static_cast<RealType>(2.04688276265993954527e-4),
  1681. static_cast<RealType>(4.43354791268634655473e-6),
  1682. };
  1683. BOOST_MATH_STATIC const RealType Q[7] = {
  1684. static_cast<RealType>(1.),
  1685. static_cast<RealType>(7.07103973315808077783e-1),
  1686. static_cast<RealType>(2.13664682181055450396e-1),
  1687. static_cast<RealType>(3.52218225168465984709e-2),
  1688. static_cast<RealType>(3.33218664347896435919e-3),
  1689. static_cast<RealType>(1.71025807471868853268e-4),
  1690. static_cast<RealType>(3.70441884597642042665e-6),
  1691. };
  1692. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1693. }
  1694. else if (x >= -32) {
  1695. RealType t = -x - 16;
  1696. // Rational Approximation
  1697. // Maximum Relative Error: 2.6236e-18
  1698. BOOST_MATH_STATIC const RealType P[6] = {
  1699. static_cast<RealType>(1.19497306481411168356e0),
  1700. static_cast<RealType>(3.90497195765498241356e-1),
  1701. static_cast<RealType>(5.13120330037626853257e-2),
  1702. static_cast<RealType>(3.38574023921119491471e-3),
  1703. static_cast<RealType>(1.12075935888344736993e-4),
  1704. static_cast<RealType>(1.48743616420183584738e-6),
  1705. };
  1706. BOOST_MATH_STATIC const RealType Q[6] = {
  1707. static_cast<RealType>(1.),
  1708. static_cast<RealType>(3.26493785348088598123e-1),
  1709. static_cast<RealType>(4.28813205161574223713e-2),
  1710. static_cast<RealType>(2.82893073845390254969e-3),
  1711. static_cast<RealType>(9.36442365966638579335e-5),
  1712. static_cast<RealType>(1.24281651532469125315e-6),
  1713. };
  1714. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1715. }
  1716. else {
  1717. result = 0;
  1718. }
  1719. }
  1720. return result;
  1721. }
  1722. template <class RealType>
  1723. BOOST_MATH_GPU_ENABLED inline RealType mapairy_cdf_minus_imp_prec(const RealType& x, const boost::math::integral_constant<int, 113>&)
  1724. {
  1725. BOOST_MATH_STD_USING
  1726. RealType result;
  1727. if (x >= -1) {
  1728. RealType t = x + 1;
  1729. // Rational Approximation
  1730. // Maximum Relative Error: 1.0688e-35
  1731. // LCOV_EXCL_START
  1732. BOOST_MATH_STATIC const RealType P[14] = {
  1733. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.23238998449671083670041452413316011920e-1),
  1734. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.14900991369455846775267187236501987891e-1),
  1735. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.19132787054572299485638029221977944555e-1),
  1736. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.87295743700300806662745209398368996653e-1),
  1737. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.41994520703802035725356673887766112213e-2),
  1738. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.78782099629586443747968633412271291734e-2),
  1739. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.05200546520666366552864974572901349343e-3),
  1740. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.51453477916196630939702866688348310208e-4),
  1741. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.15461354910584918402088506199099270742e-4),
  1742. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.43371674256124419899137414410592359185e-5),
  1743. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.35849788347057186916350200082990102088e-6),
  1744. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.50359296597872967493549820191745700442e-8),
  1745. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.21838020977580479741299141050400953125e-9),
  1746. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.46723648594704078875476888175530463986e-12),
  1747. };
  1748. BOOST_MATH_STATIC const RealType Q[13] = {
  1749. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1750. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.98700317671474659677458220091101276158e-1),
  1751. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.00405631175818416028878082789095587658e-1),
  1752. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.04189939150805562128632256692765842568e-1),
  1753. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.03621065280443734565418469521814125946e-2),
  1754. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.85722257874304617269018116436650330070e-2),
  1755. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.24191409213079401989695901900760076094e-3),
  1756. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.64269032641964601932953114106294883156e-4),
  1757. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19289631274036494326058240677240511431e-4),
  1758. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.41389309719775603006897751176159931569e-5),
  1759. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.42000309062533491486426399210996541477e-6),
  1760. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.02436961569668743353755318268149636644e-8),
  1761. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.50130875023154569442119099173406269991e-9),
  1762. };
  1763. // LCOV_EXCL_STOP
  1764. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1765. }
  1766. else if (x >= -2) {
  1767. RealType t = x + 2;
  1768. // Rational Approximation
  1769. // Maximum Relative Error: 5.1815e-35
  1770. // LCOV_EXCL_START
  1771. BOOST_MATH_STATIC const RealType P[14] = {
  1772. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.62598955251978523174755901843430986522e-1),
  1773. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.08127698872954954678270473317137288772e-1),
  1774. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.70144997468767751317246482211703706086e-1),
  1775. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.49486603823046766249106014234315835102e-1),
  1776. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.07186495389828596786579668258622667573e-2),
  1777. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.98334953533562948674335281457057445421e-2),
  1778. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.44119017374895211020429143034854620303e-3),
  1779. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.27080759819117162456137826659721634882e-3),
  1780. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.53892796920597912362370019918933112349e-4),
  1781. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.30530442651657077016130554430933607143e-5),
  1782. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.04837779538527662990102489150650534390e-6),
  1783. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.94354615171320374997141684442120888127e-7),
  1784. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.30746545799073289786965697800049892311e-8),
  1785. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.41870129065056783732691371215602982173e-9),
  1786. };
  1787. BOOST_MATH_STATIC const RealType Q[14] = {
  1788. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1789. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.75919235734607601884356783586727272494e-1),
  1790. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.57656678936617227532275100649989944452e-1),
  1791. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.72617552401870454676736869003112018648e-1),
  1792. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.59238104942208254162102314312757621047e-2),
  1793. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.06040513359343987972917295603514840777e-2),
  1794. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.26922840063034349024167652148593396307e-3),
  1795. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.25628506630180107357627955876231943531e-3),
  1796. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.81600387497542714853225329159728694926e-4),
  1797. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.08210973846891324886779444820838563800e-5),
  1798. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.68632477858150229792523037059221563861e-6),
  1799. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.43542789104866782087701759971538600076e-7),
  1800. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.70594730517167328271953424328890849790e-8),
  1801. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.30162314557860623869079601905904538470e-9),
  1802. };
  1803. // LCOV_EXCL_STOP
  1804. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1805. }
  1806. else {
  1807. RealType s = exp(2 * x * x * x / 27) / sqrt(-x * x * x);
  1808. if (x >= -4) {
  1809. RealType t = -x - 2;
  1810. // Rational Approximation
  1811. // Maximum Relative Error: 6.4678e-36
  1812. // LCOV_EXCL_START
  1813. BOOST_MATH_STATIC const RealType P[16] = {
  1814. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.31806744221966404520449104514474066823e-1),
  1815. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.50292887071777664663197915067642779665e0),
  1816. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.45140067157601150721516139901304901854e0),
  1817. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.93227973605511286112712730820664209900e0),
  1818. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.74259108933048973391560053531348126900e0),
  1819. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.77677252890665602191818487592154553094e-1),
  1820. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.71843197238558832510595724454548089268e-1),
  1821. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.62811778285151415483649897138119310816e-2),
  1822. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.74127763877120261698596916683136227034e-2),
  1823. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.24832552591462216226478550702845438540e-3),
  1824. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.93381036027487259940171548523889481080e-4),
  1825. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.02261328789519398745019578211081412570e-5),
  1826. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.75409238451885381267277435341417474231e-6),
  1827. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.09526311389365895099871581844304449319e-7),
  1828. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.96371756262605118060185816854433322493e-8),
  1829. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.88472819535099746216179119978362211227e-10),
  1830. };
  1831. BOOST_MATH_STATIC const RealType Q[16] = {
  1832. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1833. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.68923525157720774962908922391133419863e0),
  1834. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.40714902096062779527207435671907059131e0),
  1835. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.73120596883364361220343183559076165363e0),
  1836. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.56331267512666685349409906638266569733e0),
  1837. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.80956276267438042306216894159447642323e-1),
  1838. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.34213468750936211385520570062547991332e-1),
  1839. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.50081600968590616549654807511166706919e-2),
  1840. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.47297208240850928379158677132220746750e-2),
  1841. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.73392976579560287571141938466202325901e-3),
  1842. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.13858821123741335782695407397784840241e-4),
  1843. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.04103497389656828224053882850778186433e-5),
  1844. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.81040189127998139689091455192659191796e-6),
  1845. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.42176283104790992634826374270801565123e-7),
  1846. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.64077137545614380065714904794220228239e-8),
  1847. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.08139724991616322332901357866680220241e-10),
  1848. };
  1849. // LCOV_EXCL_STOP
  1850. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1851. }
  1852. else if (x >= -8) {
  1853. RealType t = -x - 4;
  1854. // Rational Approximation
  1855. // Maximum Relative Error: 3.5975e-36
  1856. // LCOV_EXCL_START
  1857. BOOST_MATH_STATIC const RealType P[16] = {
  1858. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.10294551528734705945662709421382590676e0),
  1859. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.26135857114883288617323671166863478751e0),
  1860. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.23504465936865651893193560109437792738e0),
  1861. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.41598983788870071301270649341678962009e0),
  1862. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.43871304031224174103636568402522086316e-1),
  1863. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.22745720458050596514499383658714367529e-1),
  1864. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.05976431838299244997805790000128175545e-2),
  1865. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.32087500190238014890030606301748111874e-2),
  1866. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.32754445514451500968404092049839985196e-3),
  1867. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.31866016448921762610690552586049011375e-4),
  1868. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.80197257671079297305525087998125408939e-5),
  1869. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.44212088947602969374978384512149432847e-6),
  1870. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.38857170416924025226203571589937286465e-7),
  1871. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.20239999218390467567339789443070294182e-8),
  1872. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.93965060142992479149039624149602039394e-10),
  1873. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.36407983918582149239548869529460234702e-12),
  1874. };
  1875. BOOST_MATH_STATIC const RealType Q[16] = {
  1876. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1877. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.99867960957804580209868321228347067213e0),
  1878. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.94236623527818880544030470097296139679e0),
  1879. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.21644866845440678050425616384656052588e0),
  1880. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.48653919287388803523090727546630060490e-1),
  1881. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.88696531788490258477870877792341909659e-1),
  1882. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.11157356307921406032115084386689196255e-2),
  1883. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.11071149696069503480091810333521267753e-2),
  1884. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.95274844731679437274609760294652465905e-3),
  1885. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.77971280158253322431071249000491659536e-4),
  1886. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.18092258028773913076132483326275839950e-5),
  1887. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.87773088535057996947643657676843842076e-6),
  1888. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.99609277781492599950063871899582711550e-7),
  1889. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.00465660598924300723542908245498229301e-8),
  1890. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.29174652982710100418474261697035968379e-10),
  1891. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.31746082236506935340972706820707017875e-12),
  1892. };
  1893. // LCOV_EXCL_STOP
  1894. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1895. }
  1896. else if (x >= -16) {
  1897. RealType t = -x - 8;
  1898. // Rational Approximation
  1899. // Maximum Relative Error: 2.6792e-35
  1900. // LCOV_EXCL_START
  1901. BOOST_MATH_STATIC const RealType P[15] = {
  1902. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.18246847255744057280356900905660312795e0),
  1903. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.77955886026107125189834586992142580148e0),
  1904. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.24948425302263641813107623611637262126e0),
  1905. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.42593662659560333324287312162818766556e-1),
  1906. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.62714138002904073145045478360748042164e-1),
  1907. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.56008984285541289474850396553042124777e-2),
  1908. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.84858048549330525583286373950733005244e-3),
  1909. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.30578460156038467943968005946143934751e-4),
  1910. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.93974868941529258700281962314167648967e-5),
  1911. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.95086664204515648622431580749060079100e-6),
  1912. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.57811968176644056830002158465591081929e-7),
  1913. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.27814751838906948007289825582251221538e-9),
  1914. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.06762893426725920159998333647896590440e-10),
  1915. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.15388861641344998301210173677051088515e-12),
  1916. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.83956842740198388242245209024484381888e-29),
  1917. };
  1918. BOOST_MATH_STATIC const RealType Q[14] = {
  1919. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1920. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.50056124032615852703112365430040751173e0),
  1921. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.05112559537845833793684655693572118348e0),
  1922. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.55609497026127521043140534271852131858e-1),
  1923. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.36430652394614121156238070755223942728e-1),
  1924. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.98167215021940993097697777547641188697e-2),
  1925. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.89418831310297071347013983522734394061e-3),
  1926. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.10980717618462843498917526227524790487e-4),
  1927. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.80119618735773019675212434416594954984e-5),
  1928. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.13748676086657187580746476165248613583e-6),
  1929. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.15424395860921826755718081823964568760e-7),
  1930. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.75228896859720124469916340725146705309e-9),
  1931. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.72759238269315282789451836388878919387e-10),
  1932. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.79966603543593799412565926418879689461e-12),
  1933. };
  1934. // LCOV_EXCL_STOP
  1935. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1936. }
  1937. else if (x >= -32) {
  1938. RealType t = -x - 16;
  1939. // Rational Approximation
  1940. // Maximum Relative Error: 2.1744e-36
  1941. // LCOV_EXCL_START
  1942. BOOST_MATH_STATIC const RealType P[12] = {
  1943. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19497306481411168355692832231058399132e0),
  1944. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.15593166681833539521403250736661720488e-1),
  1945. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.54020260738207743315755235213180652303e-1),
  1946. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.76467972857585566189917087631621063058e-2),
  1947. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.97922795572348613358915532172847895070e-3),
  1948. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.26998967192207380100354278434037095729e-4),
  1949. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.32827180395699855050424881575240362199e-5),
  1950. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.50587178182571637802022891868380669565e-6),
  1951. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.78252548290929962236994183546354358888e-8),
  1952. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.01519297007773622283120166415145520855e-9),
  1953. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.29602226691665918537895803270497291716e-11),
  1954. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.53666531487585211574942518181922132884e-14),
  1955. };
  1956. BOOST_MATH_STATIC const RealType Q[12] = {
  1957. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1958. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.82230649578130958108098853863277631065e-1),
  1959. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.12412482738973738235656376802445565005e-1),
  1960. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.98320116955422615960870363549721494683e-2),
  1961. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.99756654189000467678223166815845628725e-3),
  1962. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.40414942475279981724792023159180203408e-4),
  1963. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.78118445466942812088955228016254912391e-5),
  1964. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.25827002637577602812624580692342616301e-6),
  1965. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.99604467789028963216078448884632489822e-8),
  1966. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.48237134334492289420105516726562561260e-10),
  1967. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.08288201960155447241423587030002372229e-11),
  1968. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.29720612489952110448407063201146274502e-14),
  1969. };
  1970. // LCOV_EXCL_STOP
  1971. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  1972. }
  1973. else if (x >= -64) {
  1974. RealType t = -x - 32;
  1975. // Rational Approximation
  1976. // Maximum Relative Error: 3.4699e-36
  1977. // LCOV_EXCL_START
  1978. BOOST_MATH_STATIC const RealType P[10] = {
  1979. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.19659414007358083585943280640656311534e0),
  1980. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.36969140730640253987817932335415532846e-1),
  1981. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.21946928005759888612066397569236165853e-2),
  1982. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.08341720579009422518863704766395201498e-3),
  1983. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.44908614491286780138818989614277172709e-4),
  1984. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.54172482866925057749338312942859761961e-6),
  1985. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.49281630950104861570255344237175124548e-8),
  1986. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.27586759709416364899010676712546639820e-9),
  1987. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.00054716479138657682306851175059678989e-11),
  1988. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.48798342894235412426464893852098239746e-14),
  1989. };
  1990. BOOST_MATH_STATIC const RealType Q[10] = {
  1991. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  1992. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.81588658109851219975949691772676519853e-1),
  1993. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.52583331848892383968186924120872369151e-2),
  1994. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.57644670426430994363913234422346706991e-3),
  1995. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.21080164634428298820141591419770346977e-4),
  1996. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.79484074949580980980061103238709314326e-6),
  1997. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.93167250146504946763386377338487557826e-8),
  1998. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.06604193118724797924138056151582242604e-9),
  1999. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.35999937789324222934257460080153249173e-12),
  2000. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.91435929481043135336094426837156247599e-14),
  2001. };
  2002. // LCOV_EXCL_STOP
  2003. result = s * tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2004. }
  2005. else {
  2006. result = 0;
  2007. }
  2008. }
  2009. return result;
  2010. }
  2011. template <class RealType>
  2012. BOOST_MATH_GPU_ENABLED inline RealType mapairy_cdf_imp_prec(const RealType& x, bool complement, const boost::math::integral_constant<int, 53>& tag) {
  2013. if (x >= 0) {
  2014. return complement ? mapairy_cdf_plus_imp_prec(x, tag) : 1 - mapairy_cdf_plus_imp_prec(x, tag);
  2015. }
  2016. else if (x <= 0) {
  2017. return complement ? 1 - mapairy_cdf_minus_imp_prec(x, tag) : mapairy_cdf_minus_imp_prec(x, tag);
  2018. }
  2019. else {
  2020. return boost::math::numeric_limits<RealType>::quiet_NaN();
  2021. }
  2022. }
  2023. template <class RealType>
  2024. BOOST_MATH_GPU_ENABLED inline RealType mapairy_cdf_imp_prec(const RealType& x, bool complement, const boost::math::integral_constant<int, 113>& tag) {
  2025. if (x >= 0) {
  2026. return complement ? mapairy_cdf_plus_imp_prec(x, tag) : 1 - mapairy_cdf_plus_imp_prec(x, tag);
  2027. }
  2028. else if (x <= 0) {
  2029. return complement ? 1 - mapairy_cdf_minus_imp_prec(x, tag) : mapairy_cdf_minus_imp_prec(x, tag);
  2030. }
  2031. else {
  2032. return boost::math::numeric_limits<RealType>::quiet_NaN();
  2033. }
  2034. }
  2035. template <class RealType, class Policy>
  2036. BOOST_MATH_GPU_ENABLED inline RealType mapairy_cdf_imp(const mapairy_distribution<RealType, Policy>& dist, const RealType& x, bool complement) {
  2037. //
  2038. // This calculates the cdf of the Map-Airy distribution and/or its complement.
  2039. //
  2040. BOOST_MATH_STD_USING // for ADL of std functions
  2041. constexpr auto function = "boost::math::cdf(mapairy<%1%>&, %1%)";
  2042. RealType result = 0;
  2043. RealType location = dist.location();
  2044. RealType scale = dist.scale();
  2045. if (false == detail::check_location(function, location, &result, Policy()))
  2046. {
  2047. return result;
  2048. }
  2049. if (false == detail::check_scale(function, scale, &result, Policy()))
  2050. {
  2051. return result;
  2052. }
  2053. if (false == detail::check_x(function, x, &result, Policy()))
  2054. {
  2055. return result;
  2056. }
  2057. typedef typename tools::promote_args<RealType>::type result_type;
  2058. typedef typename policies::precision<result_type, Policy>::type precision_type;
  2059. typedef boost::math::integral_constant<int,
  2060. precision_type::value <= 0 ? 0 :
  2061. precision_type::value <= 53 ? 53 :
  2062. precision_type::value <= 113 ? 113 : 0
  2063. > tag_type;
  2064. static_assert(tag_type::value, "The Map-Airy distribution is only implemented for types with known precision, and 113 bits or fewer in the mantissa (ie 128 bit quad-floats");
  2065. RealType u = (x - location) / scale;
  2066. result = mapairy_cdf_imp_prec(u, complement, tag_type());
  2067. return result;
  2068. }
  2069. template <class RealType>
  2070. BOOST_MATH_GPU_ENABLED inline RealType mapairy_quantile_lower_imp_prec(const RealType& p, const boost::math::integral_constant<int, 53>&)
  2071. {
  2072. BOOST_MATH_STD_USING
  2073. RealType result;
  2074. if (p >= 0.375) {
  2075. RealType t = p - static_cast <RealType>(0.375);
  2076. // Rational Approximation
  2077. // Maximum Relative Error: 1.5488e-18
  2078. BOOST_MATH_STATIC const RealType P[7] = {
  2079. static_cast<RealType>(-1.17326074020471664075e0),
  2080. static_cast<RealType>(1.51461298154568349598e0),
  2081. static_cast<RealType>(1.19979368094343490487e1),
  2082. static_cast<RealType>(-5.94882121521324108164e0),
  2083. static_cast<RealType>(-2.20619749774447254528e1),
  2084. static_cast<RealType>(7.17766543775229176131e0),
  2085. static_cast<RealType>(4.79284243496552841508e0),
  2086. };
  2087. BOOST_MATH_STATIC const RealType Q[7] = {
  2088. static_cast<RealType>(1.),
  2089. static_cast<RealType>(1.76268072706610602584e0),
  2090. static_cast<RealType>(-4.88492535243404839734e0),
  2091. static_cast<RealType>(-5.67524172432687656881e0),
  2092. static_cast<RealType>(6.83327389947131710596e0),
  2093. static_cast<RealType>(2.91338085774159042709e0),
  2094. static_cast<RealType>(-1.41108918944159283950e0),
  2095. };
  2096. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2097. }
  2098. else if (p >= 0.25) {
  2099. RealType t = p - static_cast <RealType>(0.25);
  2100. // Rational Approximation
  2101. // Maximum Relative Error: 7.5181e-17
  2102. BOOST_MATH_STATIC const RealType P[7] = {
  2103. static_cast<RealType>(-1.63281240925531302762e0),
  2104. static_cast<RealType>(-4.92351310795930780147e0),
  2105. static_cast<RealType>(1.43448529253101759409e1),
  2106. static_cast<RealType>(3.33182629948094299473e1),
  2107. static_cast<RealType>(-3.06679026539368582747e1),
  2108. static_cast<RealType>(-2.87298447423841965301e1),
  2109. static_cast<RealType>(1.31575930750093554120e1),
  2110. };
  2111. BOOST_MATH_STATIC const RealType Q[6] = {
  2112. static_cast<RealType>(1.),
  2113. static_cast<RealType>(5.38761652244702318296e0),
  2114. static_cast<RealType>(2.40932080746189543284e0),
  2115. static_cast<RealType>(-1.69465870062123632126e1),
  2116. static_cast<RealType>(-6.39998944283654848809e0),
  2117. static_cast<RealType>(1.27168434054332272391e1),
  2118. };
  2119. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2120. }
  2121. else if (p >= 0.125) {
  2122. RealType t = p - static_cast <RealType>(0.125);
  2123. // Rational Approximation
  2124. // Maximum Relative Error: 2.3028e-18
  2125. BOOST_MATH_STATIC const RealType P[8] = {
  2126. static_cast<RealType>(-2.18765177572396469657e0),
  2127. static_cast<RealType>(-3.65752788934974426531e1),
  2128. static_cast<RealType>(-1.81144810822028903904e2),
  2129. static_cast<RealType>(-1.22434531262312950288e2),
  2130. static_cast<RealType>(8.99451018491165823831e2),
  2131. static_cast<RealType>(9.11333307522308410858e2),
  2132. static_cast<RealType>(-8.76285742384616909177e2),
  2133. static_cast<RealType>(-2.33786726970025938837e2),
  2134. };
  2135. BOOST_MATH_STATIC const RealType Q[8] = {
  2136. static_cast<RealType>(1.),
  2137. static_cast<RealType>(1.91797638291395345792e1),
  2138. static_cast<RealType>(1.24293724082506952768e2),
  2139. static_cast<RealType>(2.82393116012902543276e2),
  2140. static_cast<RealType>(-1.80472369158936285558e1),
  2141. static_cast<RealType>(-5.31764390192922827093e2),
  2142. static_cast<RealType>(-5.60586018315854885788e1),
  2143. static_cast<RealType>(1.21284324755968033098e2),
  2144. };
  2145. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2146. }
  2147. else if (ilogb(p) >= -4) {
  2148. RealType t = -log2(ldexp(p, 3));
  2149. // Rational Approximation
  2150. // Maximum Relative Error: 6.1147e-18
  2151. BOOST_MATH_STATIC const RealType P[6] = {
  2152. static_cast<RealType>(-2.18765177572396470773e0),
  2153. static_cast<RealType>(-2.19887766409334094428e0),
  2154. static_cast<RealType>(-7.77080107207360785208e-1),
  2155. static_cast<RealType>(-1.15551765136654549650e-1),
  2156. static_cast<RealType>(-6.64711321022529990367e-3),
  2157. static_cast<RealType>(-9.74212491048543799073e-5),
  2158. };
  2159. BOOST_MATH_STATIC const RealType Q[6] = {
  2160. static_cast<RealType>(1.),
  2161. static_cast<RealType>(7.91919722132624625590e-1),
  2162. static_cast<RealType>(2.17415447268626558639e-1),
  2163. static_cast<RealType>(2.41474762519410575392e-2),
  2164. static_cast<RealType>(9.41084107182696904714e-4),
  2165. static_cast<RealType>(6.65754108797614202364e-6),
  2166. };
  2167. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2168. }
  2169. else if (ilogb(p) >= -8) {
  2170. RealType t = -log2(ldexp(p, 4));
  2171. // Rational Approximation
  2172. // Maximum Relative Error: 2.0508e-17
  2173. BOOST_MATH_STATIC const RealType P[8] = {
  2174. static_cast<RealType>(-2.59822399410385085335e0),
  2175. static_cast<RealType>(-2.24306757759003016244e0),
  2176. static_cast<RealType>(-7.36208578161752060979e-1),
  2177. static_cast<RealType>(-1.15130762650287391576e-1),
  2178. static_cast<RealType>(-8.77652386123688618995e-3),
  2179. static_cast<RealType>(-2.96358888256575251437e-4),
  2180. static_cast<RealType>(-3.33661282483762192446e-6),
  2181. static_cast<RealType>(-4.19292241201527861927e-9),
  2182. };
  2183. BOOST_MATH_STATIC const RealType Q[7] = {
  2184. static_cast<RealType>(1.),
  2185. static_cast<RealType>(7.23065798041556418844e-1),
  2186. static_cast<RealType>(1.96731305131315877264e-1),
  2187. static_cast<RealType>(2.49952034298034383781e-2),
  2188. static_cast<RealType>(1.49149568322111062242e-3),
  2189. static_cast<RealType>(3.66010398525593921460e-5),
  2190. static_cast<RealType>(2.46857713549279930857e-7),
  2191. };
  2192. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2193. }
  2194. else if (ilogb(p) >= -16) {
  2195. RealType t = -log2(ldexp(p, 8));
  2196. // Rational Approximation
  2197. // Maximum Relative Error: 2.1997e-17
  2198. BOOST_MATH_STATIC const RealType P[8] = {
  2199. static_cast<RealType>(-3.67354365380697580447e0),
  2200. static_cast<RealType>(-1.52181685844845957618e0),
  2201. static_cast<RealType>(-2.40883948836320845233e-1),
  2202. static_cast<RealType>(-1.82424079258401987512e-2),
  2203. static_cast<RealType>(-6.75844978572417703979e-4),
  2204. static_cast<RealType>(-1.11273358356809152121e-5),
  2205. static_cast<RealType>(-6.12797605223700996671e-8),
  2206. static_cast<RealType>(-3.78061321691170114390e-11),
  2207. };
  2208. BOOST_MATH_STATIC const RealType Q[7] = {
  2209. static_cast<RealType>(1.),
  2210. static_cast<RealType>(3.57770840766081587688e-1),
  2211. static_cast<RealType>(4.81290550545412209056e-2),
  2212. static_cast<RealType>(3.02079969075162071807e-3),
  2213. static_cast<RealType>(8.89589626547135423615e-5),
  2214. static_cast<RealType>(1.07618717290978464257e-6),
  2215. static_cast<RealType>(3.57383804712249921193e-9),
  2216. };
  2217. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2218. }
  2219. else if (ilogb(p) >= -32) {
  2220. RealType t = -log2(ldexp(p, 16));
  2221. // Rational Approximation
  2222. // Maximum Relative Error: 2.4331e-17
  2223. BOOST_MATH_STATIC const RealType P[8] = {
  2224. static_cast<RealType>(-4.92187819510636697128e0),
  2225. static_cast<RealType>(-9.94924018698264727979e-1),
  2226. static_cast<RealType>(-7.69914962772717316098e-2),
  2227. static_cast<RealType>(-2.85558010159310978248e-3),
  2228. static_cast<RealType>(-5.19022578720207406789e-5),
  2229. static_cast<RealType>(-4.19975546950263453259e-7),
  2230. static_cast<RealType>(-1.13886013623971006760e-9),
  2231. static_cast<RealType>(-3.46758191090170732580e-13),
  2232. };
  2233. BOOST_MATH_STATIC const RealType Q[7] = {
  2234. static_cast<RealType>(1.),
  2235. static_cast<RealType>(1.77270673840643360017e-1),
  2236. static_cast<RealType>(1.18099604045834575786e-2),
  2237. static_cast<RealType>(3.66889581757166584963e-4),
  2238. static_cast<RealType>(5.34484782554469770841e-6),
  2239. static_cast<RealType>(3.19694601727035291809e-8),
  2240. static_cast<RealType>(5.24649233511937214948e-11),
  2241. };
  2242. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2243. }
  2244. else if (ilogb(p) >= -64) {
  2245. RealType t = -log2(ldexp(p, 32));
  2246. // Rational Approximation
  2247. // Maximum Relative Error: 2.7742e-17
  2248. BOOST_MATH_STATIC const RealType P[8] = {
  2249. static_cast<RealType>(-6.41443550638291133784e0),
  2250. static_cast<RealType>(-6.38369359780748328332e-1),
  2251. static_cast<RealType>(-2.43420704406734621618e-2),
  2252. static_cast<RealType>(-4.45274771094277987075e-4),
  2253. static_cast<RealType>(-3.99529078051262843241e-6),
  2254. static_cast<RealType>(-1.59758677464731620413e-8),
  2255. static_cast<RealType>(-2.14338367751477432622e-11),
  2256. static_cast<RealType>(-3.23343844538964435927e-15),
  2257. };
  2258. BOOST_MATH_STATIC const RealType Q[7] = {
  2259. static_cast<RealType>(1.),
  2260. static_cast<RealType>(8.79845511272943785289e-2),
  2261. static_cast<RealType>(2.90839059356197474893e-3),
  2262. static_cast<RealType>(4.48172838083912540123e-5),
  2263. static_cast<RealType>(3.23770691025690100895e-7),
  2264. static_cast<RealType>(9.60156044379859908674e-10),
  2265. static_cast<RealType>(7.81134095049301988435e-13),
  2266. };
  2267. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2268. }
  2269. else if (ilogb(p) >= -128) {
  2270. RealType t = -log2(ldexp(p, 64));
  2271. // Rational Approximation
  2272. // Maximum Relative Error: 3.2451e-17
  2273. BOOST_MATH_STATIC const RealType P[8] = {
  2274. static_cast<RealType>(-8.23500806363233610938e0),
  2275. static_cast<RealType>(-4.05652655284908839003e-1),
  2276. static_cast<RealType>(-7.65978833819859622912e-3),
  2277. static_cast<RealType>(-6.94194676058731901672e-5),
  2278. static_cast<RealType>(-3.08771646223818451436e-7),
  2279. static_cast<RealType>(-6.12443207313641110962e-10),
  2280. static_cast<RealType>(-4.07882839359528825925e-13),
  2281. static_cast<RealType>(-3.05720104049292610799e-17),
  2282. };
  2283. BOOST_MATH_STATIC const RealType Q[7] = {
  2284. static_cast<RealType>(1.),
  2285. static_cast<RealType>(4.37395212065018405474e-2),
  2286. static_cast<RealType>(7.18654254114820140590e-4),
  2287. static_cast<RealType>(5.50371158026951899491e-6),
  2288. static_cast<RealType>(1.97583864365011234715e-8),
  2289. static_cast<RealType>(2.91169706068202431036e-11),
  2290. static_cast<RealType>(1.17716830382540977039e-14),
  2291. };
  2292. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2293. }
  2294. else if (ilogb(p) >= -256) {
  2295. RealType t = -log2(ldexp(p, 128));
  2296. // Rational Approximation
  2297. // Maximum Relative Error: 3.8732e-17
  2298. BOOST_MATH_STATIC const RealType P[8] = {
  2299. static_cast<RealType>(-1.04845570631944023913e1),
  2300. static_cast<RealType>(-2.56502856165700644836e-1),
  2301. static_cast<RealType>(-2.40615394566347412600e-3),
  2302. static_cast<RealType>(-1.08364601171893250764e-5),
  2303. static_cast<RealType>(-2.39603255140022514289e-8),
  2304. static_cast<RealType>(-2.36344017673944676435e-11),
  2305. static_cast<RealType>(-7.83146284114485675414e-15),
  2306. static_cast<RealType>(-2.92218240202835807955e-19),
  2307. };
  2308. BOOST_MATH_STATIC const RealType Q[7] = {
  2309. static_cast<RealType>(1.),
  2310. static_cast<RealType>(2.17740414929742679904e-2),
  2311. static_cast<RealType>(1.78084231709097280884e-4),
  2312. static_cast<RealType>(6.78870668961146609668e-7),
  2313. static_cast<RealType>(1.21313439060489363960e-9),
  2314. static_cast<RealType>(8.89917934953781122884e-13),
  2315. static_cast<RealType>(1.79115540847944524599e-16),
  2316. };
  2317. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2318. }
  2319. else if (ilogb(p) >= -512) {
  2320. RealType t = -log2(ldexp(p, 256));
  2321. // Rational Approximation
  2322. // Maximum Relative Error: 4.6946e-17
  2323. BOOST_MATH_STATIC const RealType P[8] = {
  2324. static_cast<RealType>(-1.32865827226175698181e1),
  2325. static_cast<RealType>(-1.61802434199627472010e-1),
  2326. static_cast<RealType>(-7.55642602577784211259e-4),
  2327. static_cast<RealType>(-1.69457608092375302291e-6),
  2328. static_cast<RealType>(-1.86612389867293722402e-9),
  2329. static_cast<RealType>(-9.17015770142364635163e-13),
  2330. static_cast<RealType>(-1.51422473889348610974e-16),
  2331. static_cast<RealType>(-2.81661279271583206526e-21),
  2332. };
  2333. BOOST_MATH_STATIC const RealType Q[7] = {
  2334. static_cast<RealType>(1.),
  2335. static_cast<RealType>(1.08518414679241420227e-2),
  2336. static_cast<RealType>(4.42335224797004486239e-5),
  2337. static_cast<RealType>(8.40387821972524402121e-8),
  2338. static_cast<RealType>(7.48486746424527560620e-11),
  2339. static_cast<RealType>(2.73676810622938942041e-14),
  2340. static_cast<RealType>(2.74588200481263214866e-18),
  2341. };
  2342. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2343. }
  2344. else if (ilogb(p) >= -1024) {
  2345. RealType t = -log2(ldexp(p, 512));
  2346. // Rational Approximation
  2347. // Maximum Relative Error: 5.7586e-17
  2348. BOOST_MATH_STATIC const RealType P[8] = {
  2349. static_cast<RealType>(-1.67937186583822375593e1),
  2350. static_cast<RealType>(-1.01958138247797604098e-1),
  2351. static_cast<RealType>(-2.37409774265951876695e-4),
  2352. static_cast<RealType>(-2.65483321307104128810e-7),
  2353. static_cast<RealType>(-1.45803536947907216594e-10),
  2354. static_cast<RealType>(-3.57375116523338994342e-14),
  2355. static_cast<RealType>(-2.94401318006358820268e-18),
  2356. static_cast<RealType>(-2.73260616170245224789e-23),
  2357. };
  2358. BOOST_MATH_STATIC const RealType Q[7] = {
  2359. static_cast<RealType>(1.),
  2360. static_cast<RealType>(5.41357843707822974161e-3),
  2361. static_cast<RealType>(1.10082540037527566536e-5),
  2362. static_cast<RealType>(1.04338126042963003178e-8),
  2363. static_cast<RealType>(4.63619608458569600346e-12),
  2364. static_cast<RealType>(8.45781310395535984099e-16),
  2365. static_cast<RealType>(4.23432554226506409568e-20),
  2366. };
  2367. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2368. }
  2369. else {
  2370. result = -boost::math::numeric_limits<RealType>::infinity();
  2371. }
  2372. return result;
  2373. }
  2374. template <class RealType>
  2375. BOOST_MATH_GPU_ENABLED inline RealType mapairy_quantile_lower_imp_prec(const RealType& p, const boost::math::integral_constant<int, 113>&)
  2376. {
  2377. BOOST_MATH_STD_USING
  2378. RealType result;
  2379. if (p >= 0.4375) {
  2380. RealType t = p - static_cast <RealType>(0.4375);
  2381. // Rational Approximation
  2382. // Maximum Relative Error: 4.2901e-35
  2383. // LCOV_EXCL_START
  2384. BOOST_MATH_STATIC const RealType P[10] = {
  2385. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.48344198262277235851026749871350753173e-1),
  2386. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.18249834490570496537675012473572546187e0),
  2387. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.20191368895639224466285643454767208281e1),
  2388. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.88388953372157636908236843798588258539e1),
  2389. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.59477796311326067051769635858472572709e1),
  2390. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.88799146700484120781026039104654730797e1),
  2391. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.15708831983930955608517858269193800412e1),
  2392. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.01389336086567891484877690859385409842e2),
  2393. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.16683694881010716925933071465043323946e1),
  2394. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.04356966421177683585461937085598186805e1),
  2395. };
  2396. BOOST_MATH_STATIC const RealType Q[11] = {
  2397. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2398. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.75444066345435020043849341970820565274e-1),
  2399. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.95105673975812427406540024601734210826e0),
  2400. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.20381124524894051002242766595737443257e0),
  2401. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.48370658634610329590305283520183480026e1),
  2402. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.52213602242009530270284305006282822794e-1),
  2403. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.91028722773916006242187843372209197705e1),
  2404. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.76130245344411748356977700519731978720e0),
  2405. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.30834721900169773543149860814908904224e1),
  2406. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.37863084758381651884340710544840951679e0),
  2407. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.46880981703613838666108664771931239970e0),
  2408. };
  2409. // LCOV_EXCL_STOP
  2410. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2411. }
  2412. else if (p >= 0.375) {
  2413. RealType t = p - static_cast <RealType>(0.375);
  2414. // Rational Approximation
  2415. // Maximum Relative Error: 2.8433e-36
  2416. // LCOV_EXCL_START
  2417. BOOST_MATH_STATIC const RealType P[11] = {
  2418. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.17326074020471664204142312429732771661e0),
  2419. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.23412560010002723970559712941124583385e0),
  2420. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.83665111310407767293290698145068379130e1),
  2421. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.38459476870110655357485107373883403534e1),
  2422. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.28751995328228442619291346921055105808e1),
  2423. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.31663592034507247231393516167247241037e1),
  2424. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.13629333446941271397790762651183997586e2),
  2425. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.80674058829101054663235662701823250421e1),
  2426. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.53226182094253065852552393446365315319e1),
  2427. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.14713948941614711932063053969010219677e1),
  2428. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.62979741122708118776725634304028246971e0),
  2429. };
  2430. BOOST_MATH_STATIC const RealType Q[10] = {
  2431. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2432. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.10550060286464202595779024353437346419e0),
  2433. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.15893254630199957990897452211066782021e0),
  2434. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.58964066823516762861256609311733069353e1),
  2435. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.73352515261971291505497909338586980605e0),
  2436. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.64737859211974163695241658186141083513e1),
  2437. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.79137714768236053008878088337762178011e0),
  2438. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.71851514659301019977259792564627124877e1),
  2439. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.37210093190088984630526671624779422232e0),
  2440. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.06793750951779308425209267821815264457e1),
  2441. };
  2442. // LCOV_EXCL_STOP
  2443. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2444. }
  2445. else if (p >= 0.25) {
  2446. RealType t = p - static_cast <RealType>(0.25);
  2447. // Rational Approximation
  2448. // Maximum Relative Error: 5.9072e-35
  2449. // LCOV_EXCL_START
  2450. BOOST_MATH_STATIC const RealType P[13] = {
  2451. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.63281240925531315038207673147576291783e0),
  2452. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.72733898245766165408685147762489513406e1),
  2453. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.48666841594842113608962500631836790675e1),
  2454. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.38711336213357101067420572773139678571e1),
  2455. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.19536066931882831915715343914510496760e2),
  2456. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.70911330354860558400876197129777829223e2),
  2457. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.46138758869321272507090399082047865434e3),
  2458. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.42653825421465476333482312795245170700e2),
  2459. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.68040069633027903153088221686431049116e3),
  2460. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.63017854949929226947577854802720988740e2),
  2461. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.57362168966659376351959631576588023516e2),
  2462. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.48386631313725080746815524770260451090e2),
  2463. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.03293129698111279047104766073456412318e1),
  2464. };
  2465. BOOST_MATH_STATIC const RealType Q[13] = {
  2466. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2467. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.29511778027351594854005887702013466376e1),
  2468. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.66155745848864270109281703659789474448e1),
  2469. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.25628362783798417463294553777015370203e1),
  2470. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.93162726153946899828589402901015679821e2),
  2471. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.51582398149308841534372162372276623400e2),
  2472. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.55512400116480727630652657714109740448e2),
  2473. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.11949742749256615588470329024257669470e2),
  2474. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.28090154738508864776480712360731968283e0),
  2475. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.44307717248171941824014971579691790721e2),
  2476. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.33595130666758203099507440236958725924e-1),
  2477. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.76156378002782668186592725145930755636e1),
  2478. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.70446647862725980215630194019740606935e0),
  2479. };
  2480. // LCOV_EXCL_STOP
  2481. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2482. }
  2483. else if (p >= 0.125) {
  2484. RealType t = p - static_cast <RealType>(0.125);
  2485. // Rational Approximation
  2486. // Maximum Relative Error: 9.9092e-36
  2487. // LCOV_EXCL_START
  2488. BOOST_MATH_STATIC const RealType P[15] = {
  2489. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.18765177572396470161180571018467019660e0),
  2490. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.16991481696416567893311341049825218287e1),
  2491. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.25497491118598918048058751362064598010e3),
  2492. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.00259915194411316966036757165146681474e4),
  2493. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.20350803730836873687692010728689867756e4),
  2494. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.75441278117456011071671644613599089820e4),
  2495. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.18844967505497310645091822621081741562e5),
  2496. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.84771867850847121528386231811667556346e5),
  2497. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.78112436422992766542256241612018834150e5),
  2498. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.82617957794395420193751983521804760378e5),
  2499. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.77260227244465268981198741998181334875e5),
  2500. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.61918290776044518321561351472048170874e5),
  2501. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.10309368217936941851272359946015001037e5),
  2502. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.68917274690585744147547352309416731690e5),
  2503. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.96914697182030973966321601422851730384e4),
  2504. };
  2505. BOOST_MATH_STATIC const RealType Q[15] = {
  2506. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2507. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.98063872144867195074924232601423646991e1),
  2508. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.65911346382127464683324945513128779971e2),
  2509. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.02451223307009464199634546540152067898e3),
  2510. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.12662676019712475980273334769644047369e4),
  2511. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.77637305574675655673572303462430608857e4),
  2512. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.65900204382557635710258095712789133767e4),
  2513. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.61649498173261886264315880770449636676e5),
  2514. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.29867325788870863753779283018061152414e5),
  2515. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.31375646045453788071216808289409712455e4),
  2516. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.91053361331987954531162452163243245571e5),
  2517. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.30917504462260061766689326034981496723e5),
  2518. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.95779171217851232246427282884386844906e5),
  2519. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.07234815204245866330282860014624832711e4),
  2520. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.21353269292094971546479026200435095695e4),
  2521. };
  2522. // LCOV_EXCL_STOP
  2523. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2524. }
  2525. else if (ilogb(p) >= -4) {
  2526. RealType t = -log2(ldexp(p, 3));
  2527. // Rational Approximation
  2528. // Maximum Relative Error: 3.9653e-35
  2529. // LCOV_EXCL_START
  2530. BOOST_MATH_STATIC const RealType P[11] = {
  2531. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.18765177572396470161180571018467025793e0),
  2532. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.94718878144788678915739777385667044494e0),
  2533. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.01760622104142726407095836139719210570e0),
  2534. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.27585388152893587017559610649258643106e0),
  2535. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.26494992809545184138230791849722703452e-1),
  2536. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.19962820888633928632710264415572027960e-2),
  2537. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.10249328404135065767844288193594496173e-3),
  2538. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.94733898567966142295343935527193851633e-4),
  2539. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.10350856810280579594619259121755788797e-6),
  2540. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.23852908701349250480831167491889740823e-7),
  2541. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.61008160195204632725691076288641221707e-10),
  2542. };
  2543. BOOST_MATH_STATIC const RealType Q[11] = {
  2544. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2545. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.59109221235949005113322202980300291082e0),
  2546. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.07119192591092503378838510797916225920e0),
  2547. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.97313678065269932508447079892684333156e-1),
  2548. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.85743007214453288049750256975889151838e-2),
  2549. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.21504290861269099964963866156493713716e-2),
  2550. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.00880286431998922077891394903879512720e-3),
  2551. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.78806057460269900288838437267359072282e-5),
  2552. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.15390284861815831078443996558014864171e-6),
  2553. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.09877166004503937701692216421704042881e-8),
  2554. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.01544823753120969225271131241177003165e-11),
  2555. };
  2556. // LCOV_EXCL_STOP
  2557. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2558. }
  2559. else if (ilogb(p) >= -8) {
  2560. RealType t = -log2(ldexp(p, 4));
  2561. // Rational Approximation
  2562. // Maximum Relative Error: 6.7872e-36
  2563. // LCOV_EXCL_START
  2564. BOOST_MATH_STATIC const RealType P[15] = {
  2565. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.59822399410385083283727681965013517187e0),
  2566. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.30676107401101401386206170152508285083e0),
  2567. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.14999782004905950712290914501961213222e0),
  2568. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.33941786334132569296061539102765384372e0),
  2569. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.67220197146826865151515598496049341734e-1),
  2570. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.80553562310354708419148501358813792297e-2),
  2571. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.69365728863553037992854715314245847166e-3),
  2572. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.66571611322125393586164383361858996769e-4),
  2573. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.60112572827002965346926427208336150737e-5),
  2574. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.82368436189138780270310776927920829805e-6),
  2575. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.53112953085778860983110669544602606343e-8),
  2576. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.47363651755817041383574210879856850108e-10),
  2577. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.56959356177318833325064543662295824581e-12),
  2578. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.16259632533790175212174199386945953139e-14),
  2579. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.51102540845397821195190063256442894688e-18),
  2580. };
  2581. BOOST_MATH_STATIC const RealType Q[14] = {
  2582. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2583. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.51733661576324699382035973518172469602e0),
  2584. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.01435607980568082538278883569729476204e0),
  2585. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.93274478117803447229185270863587786287e-1),
  2586. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.79695020433868416640781960667235896490e-2),
  2587. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.64179255575983014759473815411232853821e-2),
  2588. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.88411076775875459504324039642698874213e-3),
  2589. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.47924359965537384942568979646011627522e-4),
  2590. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.80915944234873904741224397674033111178e-6),
  2591. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.67530059257263142305079790717032648103e-7),
  2592. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.59778634436027309520742387952911132163e-9),
  2593. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.45772841855129835242992919296397034883e-11),
  2594. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.40356170422999016176996652783329671363e-13),
  2595. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.31127037096552892520323998665757802862e-16),
  2596. };
  2597. // LCOV_EXCL_STOP
  2598. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2599. }
  2600. else if (ilogb(p) >= -16) {
  2601. RealType t = -log2(ldexp(p, 8));
  2602. // Rational Approximation
  2603. // Maximum Relative Error: 7.6679e-36
  2604. // LCOV_EXCL_START
  2605. BOOST_MATH_STATIC const RealType P[15] = {
  2606. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.67354365380697578246790709817724831418e0),
  2607. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.98681625368564496421038758088088788795e0),
  2608. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.07310677200866436332040539417232353673e0),
  2609. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.24429836496456823308103613923194387860e-1),
  2610. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.02985399190977938381625172095575017346e-2),
  2611. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.76782196972948240235456454778537838123e-3),
  2612. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.74449002785643398012450514191731166637e-4),
  2613. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.59599894044461264694825875303563328822e-6),
  2614. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.25326249969126313897827328136779597159e-7),
  2615. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.41714701672521323699602179629851858792e-9),
  2616. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.43197925999694667433180053594831915164e-11),
  2617. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.84385683045691486021670951412023644809e-13),
  2618. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.34484740544060627138216383389282372695e-15),
  2619. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.69717198111130468014375331439613690658e-18),
  2620. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.54464319402577486444841981479085908190e-22),
  2621. };
  2622. BOOST_MATH_STATIC const RealType Q[14] = {
  2623. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2624. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.56568169258142086426383908572004868200e-1),
  2625. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.52144703581828715720555168887427064424e-1),
  2626. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.87268567039210776554113754014224005739e-2),
  2627. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.04907480436107533324385788289629535047e-3),
  2628. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.05063218951887755000006493061952858632e-4),
  2629. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.88707869862323507236241669797692957827e-5),
  2630. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.12876335369047582931728838551780783006e-6),
  2631. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.96657547014655679104867167083078285517e-8),
  2632. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.05799908632250375607393338998205481867e-10),
  2633. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.26543514080500125624753383852230043206e-12),
  2634. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.02102501711063497529014782040893679505e-14),
  2635. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.91577723105757841509716090936343311518e-17),
  2636. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.13824283239122976911704652025193325941e-20),
  2637. };
  2638. // LCOV_EXCL_STOP
  2639. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2640. }
  2641. else if (ilogb(p) >= -32) {
  2642. RealType t = -log2(ldexp(p, 16));
  2643. // Rational Approximation
  2644. // Maximum Relative Error: 8.6323e-36
  2645. // LCOV_EXCL_START
  2646. BOOST_MATH_STATIC const RealType P[15] = {
  2647. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.92187819510636694694450607724165689649e0),
  2648. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.97763858433958798529675258052376253402e0),
  2649. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.51315096979196319830162238831654165509e-1),
  2650. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.63462872759639470195664268077372442947e-2),
  2651. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.42843455093529447002457295994721102683e-3),
  2652. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.09839699044798405685726233251577671229e-4),
  2653. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.42918585783783247934440868680748693033e-6),
  2654. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.39927851612709063686969934343256912856e-8),
  2655. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.08811978806833318962489621493456773153e-9),
  2656. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.05790315329766847040100971840989677130e-11),
  2657. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.45479905512618918078640786598987515012e-14),
  2658. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.26725031195260767541308143946590024995e-16),
  2659. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.93921283405116349017396651678347306610e-19),
  2660. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.46989755992471397407520449698676945629e-22),
  2661. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.84098833615882764168840211033822541979e-26),
  2662. };
  2663. BOOST_MATH_STATIC const RealType Q[14] = {
  2664. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2665. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.76933186134913044021577076301874622292e-1),
  2666. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.25794095712489484166470336696962749356e-2),
  2667. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.02367257449622569623375613790000874499e-3),
  2668. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.72422948147678152291655497515112236849e-4),
  2669. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.54841786738844966378222670550160421679e-5),
  2670. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.40690766057741905625149753730480294357e-7),
  2671. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.57722740290698689456097239435447030950e-9),
  2672. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.12202417878861628530322715231540006386e-10),
  2673. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.52053248659561670052645118655279630611e-13),
  2674. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.93156242508301535729374373870786335203e-15),
  2675. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.40767922796889118151219837068812449420e-17),
  2676. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.83472702205100162081157644960354192597e-20),
  2677. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.07575352729625387198150555665307193572e-24),
  2678. };
  2679. // LCOV_EXCL_STOP
  2680. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2681. }
  2682. else if (ilogb(p) >= -64) {
  2683. RealType t = -log2(ldexp(p, 32));
  2684. // Rational Approximation
  2685. // Maximum Relative Error: 9.8799e-36
  2686. // LCOV_EXCL_START
  2687. BOOST_MATH_STATIC const RealType P[15] = {
  2688. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.41443550638291131009585191506467028820e0),
  2689. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.27887396494095561461365753577189254063e0),
  2690. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.12752633002089885479040650194288302309e-1),
  2691. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.79073355729340068320968150408320521772e-3),
  2692. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.92104558368762745368896313096467732214e-4),
  2693. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.31521786147036353766882145733055166296e-6),
  2694. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.69209485282228501578601478546441260206e-8),
  2695. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.17440286764020598209076590905417295956e-10),
  2696. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.24323354132100896221825450145208350291e-12),
  2697. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.53395893728239001663242998169841168859e-14),
  2698. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.68737623513761169307963299679882178852e-17),
  2699. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.34293243065056704017609034428511365032e-19),
  2700. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.16077944943653158589001897848048630079e-22),
  2701. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.62195354664281744711336666974567406606e-26),
  2702. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.34400562353945663460416286570988365992e-30),
  2703. };
  2704. BOOST_MATH_STATIC const RealType Q[14] = {
  2705. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2706. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.87838171063584994806998206766890809367e-1),
  2707. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.55395225505766120991458653457272783334e-2),
  2708. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.45282436421694718640472363162421055686e-4),
  2709. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.29570159526914149727970023744213510609e-5),
  2710. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.75502365627517415214497786524319814617e-7),
  2711. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.74140267916464056408693097635546173776e-9),
  2712. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.53554952415602030474322188152855226456e-11),
  2713. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.25818606585833092910042975933757268581e-13),
  2714. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.79945579370700383986587672831350689541e-15),
  2715. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.64188969985517050219881299229805701044e-18),
  2716. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.59811800080967790439078895802795103852e-21),
  2717. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.28225402720788909349967839966304553864e-24),
  2718. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.22313199865592821923485268860178384308e-28),
  2719. };
  2720. // LCOV_EXCL_STOP
  2721. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2722. }
  2723. else if (ilogb(p) >= -128) {
  2724. RealType t = -log2(ldexp(p, 64));
  2725. // Rational Approximation
  2726. // Maximum Relative Error: 1.1548e-35
  2727. // LCOV_EXCL_START
  2728. BOOST_MATH_STATIC const RealType P[15] = {
  2729. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.23500806363233607692361021471929016922e0),
  2730. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.16747938711332885952564885548768072606e-1),
  2731. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.58252672740225210061031286151136185818e-2),
  2732. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.15477223656783400505701577048140375949e-4),
  2733. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.51130817987857130928725357067032472382e-5),
  2734. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.68955185187558206711296837951129048907e-7),
  2735. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.30418343536824247801373327173028702308e-9),
  2736. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.96029044368524575193330776540736319950e-12),
  2737. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.53259926294848786440686413056632823519e-14),
  2738. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.09476918795964320022985872737468492126e-17),
  2739. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.20864569882477440934325776445799604204e-20),
  2740. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.01321468510611172635388570487951907905e-23),
  2741. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.45079221107904118975166347269173516170e-26),
  2742. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.36559452694774774399884349254686988041e-30),
  2743. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.92396730553947142987611521115040472261e-35),
  2744. };
  2745. BOOST_MATH_STATIC const RealType Q[14] = {
  2746. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2747. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.36599681872296382199486815169747516110e-2),
  2748. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.86330544720458446620644055149504593514e-3),
  2749. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.23793435123936109978741252388806998743e-5),
  2750. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.41867848381419339587560909646887411175e-6),
  2751. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.46493580168298395584601073832432583371e-8),
  2752. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.03537470107933172406224278121518518287e-10),
  2753. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.00375884189083338846655326801486182158e-13),
  2754. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.62515041281615938158455493618149216047e-15),
  2755. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.42337949780187570810208014464208536484e-18),
  2756. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.40196890950995648233637422892711654146e-21),
  2757. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.11894256193449973803773962108906527772e-24),
  2758. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.00900961462911160554915139090711911885e-27),
  2759. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.65825716532665817972751320034032284421e-32),
  2760. };
  2761. // LCOV_EXCL_STOP
  2762. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2763. }
  2764. else if (ilogb(p) >= -256) {
  2765. RealType t = -log2(ldexp(p, 128));
  2766. // Rational Approximation
  2767. // Maximum Relative Error: 1.3756e-35
  2768. // LCOV_EXCL_START
  2769. BOOST_MATH_STATIC const RealType P[15] = {
  2770. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.04845570631944023525776899386112795330e1),
  2771. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.18146685146173151383718092529868406030e-1),
  2772. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.13255476532916847606354932879190731233e-2),
  2773. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.44228173780288838603949849889291143631e-4),
  2774. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.18663599891768480607165516401619315227e-6),
  2775. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.61193813386433438633008774630150180359e-9),
  2776. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.54402603714659392010463991032389692959e-11),
  2777. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.76816632514967325885563032378775486543e-14),
  2778. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.22774672528068516513970610441705738842e-16),
  2779. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.47312348271366325243169398780745416279e-19),
  2780. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.10984325972747808970318612951079014854e-22),
  2781. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.81620524028936785168005732104270722618e-26),
  2782. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.03443227423068771484783389914203726108e-29),
  2783. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.02313300749670214384591200940841254958e-34),
  2784. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.40321396496046206171642334628524367374e-39),
  2785. };
  2786. BOOST_MATH_STATIC const RealType Q[14] = {
  2787. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2788. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.67292043485384876322219919215413286868e-2),
  2789. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.61652550158809553935603664087740554258e-4),
  2790. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.14722810796821047167211543031044501921e-5),
  2791. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.78954660078305461714050086730116257387e-8),
  2792. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.52794892087101750452585357544956835504e-10),
  2793. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.59652255206657812422503741672829368618e-12),
  2794. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.84914442937017449248597857220675602148e-15),
  2795. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.23662183613814475007146598734598810102e-18),
  2796. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.55388618781592901470236982277678753407e-21),
  2797. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.20418178834057564300014964843066904024e-24),
  2798. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.48606639104883413456676877330419513129e-27),
  2799. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.39845313960416564778273486179935754019e-31),
  2800. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.14538443937605324316706211070799970095e-35),
  2801. };
  2802. // LCOV_EXCL_STOP
  2803. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2804. }
  2805. else if (ilogb(p) >= -512) {
  2806. RealType t = -log2(ldexp(p, 256));
  2807. // Rational Approximation
  2808. // Maximum Relative Error: 1.6639e-35
  2809. // LCOV_EXCL_START
  2810. BOOST_MATH_STATIC const RealType P[15] = {
  2811. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.32865827226175697711590794217590458484e1),
  2812. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.27551166309670994513910580518431041518e-1),
  2813. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.57161482253140058637495100797888501265e-3),
  2814. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.26908727392152312216118985392395130974e-5),
  2815. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.31391169101865809627389212651592902649e-8),
  2816. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.58926174475498352884244229017384309804e-10),
  2817. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.97074898765380614681225071978849430802e-13),
  2818. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.59852103341093122669197704225736036199e-16),
  2819. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.97287954178083606552531325613580819555e-19),
  2820. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.57634773176875526612407357244997035312e-22),
  2821. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.34467233210713881817055138794482883359e-25),
  2822. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.91236170873875898506577053309622472122e-29),
  2823. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.12220990075567880730037575497818287435e-33),
  2824. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.20881889651487527801970182542596258873e-37),
  2825. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.56848486878078288956741060120464349537e-43),
  2826. };
  2827. BOOST_MATH_STATIC const RealType Q[14] = {
  2828. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2829. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.33267370502089423930888060969568705647e-2),
  2830. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.39632352029900752622967578086289898150e-4),
  2831. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.42703739831525305516280300008439396218e-6),
  2832. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.45767617531685380458878368024246654652e-9),
  2833. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.40344962756110545138002101382437142038e-11),
  2834. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.47015258371290492450093115369080460499e-14),
  2835. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.97280918936580227687603348219414768787e-17),
  2836. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.40441024286579579491205384492088325576e-20),
  2837. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.26130000914236204012152918399995098882e-23),
  2838. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.03893990417552709151955156348527062863e-27),
  2839. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.12687002255767114781771099969545907763e-31),
  2840. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.74218645918961186861014420578277888513e-35),
  2841. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.36897549168687040570349702061165281706e-39),
  2842. };
  2843. // LCOV_EXCL_STOP
  2844. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2845. }
  2846. else if (ilogb(p) >= -1024) {
  2847. RealType t = -log2(ldexp(p, 512));
  2848. // Rational Approximation
  2849. // Maximum Relative Error: 2.0360e-35
  2850. // LCOV_EXCL_START
  2851. BOOST_MATH_STATIC const RealType P[15] = {
  2852. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.67937186583822375017526293948703697225e1),
  2853. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.06681764321003187068904973985967908140e-1),
  2854. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.12508887240195683379004033347903251977e-3),
  2855. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.56847823157999127998977939588643284176e-6),
  2856. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.31281869105767454049413701029676766275e-9),
  2857. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.01498951390503036399081209706853095793e-11),
  2858. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.72866867304007090391517734634589972858e-15),
  2859. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.44819806993104486828983054294866921869e-18),
  2860. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.91441365806306460165885645136864045231e-21),
  2861. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.71364347097027340365042558634044496149e-25),
  2862. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.63601648491144929836375956218857970640e-28),
  2863. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.76948956673676441236280803645598939735e-32),
  2864. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.47367651137203634311843318915161504046e-37),
  2865. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.83187517541957887917067558455828915184e-41),
  2866. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.21480186561579326423946788448005430367e-47),
  2867. };
  2868. BOOST_MATH_STATIC const RealType Q[14] = {
  2869. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2870. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.16494591376838053609854716130343599036e-2),
  2871. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.97651667629616309497454026431358820357e-5),
  2872. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.77741398674456235952879526959641925087e-7),
  2873. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.39478109667902532743651043316724748827e-10),
  2874. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.35965905056304225411108295866332882930e-13),
  2875. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.83206524996481183422082802793852630990e-16),
  2876. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.30320324476590103123012385840054658401e-19),
  2877. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.30322948189714718819437477682869360798e-23),
  2878. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.43729790298535728717477691270336818161e-26),
  2879. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.89788697114251966298674871919685298106e-30),
  2880. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.43510901856942238937717065880365530871e-34),
  2881. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.38232043389918216652459244727737381677e-38),
  2882. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.64599465785019268214108345671361994702e-43),
  2883. };
  2884. // LCOV_EXCL_STOP
  2885. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2886. }
  2887. else if (ilogb(p) >= -2048) {
  2888. RealType t = -log2(ldexp(p, 1024));
  2889. // Rational Approximation
  2890. // Maximum Relative Error: 2.5130e-35
  2891. // LCOV_EXCL_START
  2892. BOOST_MATH_STATIC const RealType P[15] = {
  2893. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.11959316095291435774375635827672517008e1),
  2894. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.30292575371366023255165927527306483022e-1),
  2895. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.54260157439166096303943109715675142318e-4),
  2896. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.61232819199170639867079290977704351939e-7),
  2897. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.74481972848503486840161528924694379655e-10),
  2898. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.98283577906243441829434029827766571263e-13),
  2899. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.90691715740583828769850056130458574520e-16),
  2900. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.31354728925505346732804698899977180508e-20),
  2901. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.42545288372836698650371589645832759416e-23),
  2902. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.12901629676328680681102537492164204387e-27),
  2903. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.99690040253176100731314099573187027309e-31),
  2904. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.07899506956133955785140496937520311210e-35),
  2905. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.88607240095256436460507438213387199067e-40),
  2906. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.78815984551154095621830792130401294111e-45),
  2907. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.20516030880916148179297554212609531432e-51),
  2908. };
  2909. BOOST_MATH_STATIC const RealType Q[14] = {
  2910. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2911. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.81973541224235020744673910266545976833e-3),
  2912. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.49156990107280109344880219729275939242e-5),
  2913. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.21606730563542176411852745162267260946e-8),
  2914. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.11449329529433741944366607648360521674e-11),
  2915. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.35659138507940819452801802756409587220e-14),
  2916. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.95708516718550485872934856595725983907e-18),
  2917. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.78871290972777009292563576533612002908e-21),
  2918. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.60955318960542258732596447917271198307e-25),
  2919. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.72437581728117963125690670426402194936e-29),
  2920. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.77473938855958487119889840032590783232e-33),
  2921. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.66198494713809467076392278745811981500e-37),
  2922. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.34142897042941614778352280692901008538e-42),
  2923. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.98791658647635156162347063765388728959e-47),
  2924. };
  2925. // LCOV_EXCL_STOP
  2926. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2927. }
  2928. else if (ilogb(p) >= -4096) {
  2929. RealType t = -log2(ldexp(p, 2048));
  2930. // Rational Approximation
  2931. // Maximum Relative Error: 3.1220e-35
  2932. // LCOV_EXCL_START
  2933. BOOST_MATH_STATIC const RealType P[15] = {
  2934. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.67307564006689676593687414536012112755e1),
  2935. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.21005690250741024744367516466433711478e-2),
  2936. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.11537345869365655126739041291119096558e-4),
  2937. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.82910297156061391001507891422501792453e-8),
  2938. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.51574933516708249049824513935386420692e-11),
  2939. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.56433757960363802088718489136097249753e-14),
  2940. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.74248235865301086829849817739500215149e-18),
  2941. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.19151506367084295119369434315371762091e-22),
  2942. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.98518959000360170320183116510466814569e-26),
  2943. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.21330422702314763225472001861559380186e-30),
  2944. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.44346922987964428874014866468161821471e-34),
  2945. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.59773305152191273570416120169527607421e-39),
  2946. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.81894412321532723356954669501665983316e-44),
  2947. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.25766346856943928908756472385992861288e-49),
  2948. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.44601448994095786447982489957909713982e-55),
  2949. };
  2950. BOOST_MATH_STATIC const RealType Q[14] = {
  2951. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2952. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.90814053669730896497462224007523900520e-3),
  2953. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.72450689508305973756255440356759005330e-6),
  2954. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.76517273086984384225845151573287252506e-9),
  2955. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.31844251885317815627707511621078762352e-12),
  2956. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.22689324865113257769413663010725436393e-16),
  2957. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.27524826460469866934006001123700331335e-20),
  2958. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.39172850948322201614266822896191911031e-23),
  2959. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.40343613937272428197414545004329993769e-27),
  2960. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.17936773028976355507339458927541970545e-32),
  2961. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.66512598049860260933817550698863263184e-36),
  2962. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.06432209670481882442649684139775366719e-41),
  2963. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.10247886333916820534393624270217678968e-46),
  2964. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.40899321122058714028548211810431871877e-51),
  2965. };
  2966. // LCOV_EXCL_STOP
  2967. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  2968. }
  2969. else if (ilogb(p) >= -8192) {
  2970. RealType t = -log2(ldexp(p, 4096));
  2971. // Rational Approximation
  2972. // Maximum Relative Error: 3.8974e-35
  2973. // LCOV_EXCL_START
  2974. BOOST_MATH_STATIC const RealType P[15] = {
  2975. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.36960987939726803544369406181770745475e1),
  2976. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.17239311695985070524235502979761682692e-2),
  2977. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.51192208811996535244435318068035492922e-5),
  2978. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.38938553034896173195617671475670860841e-8),
  2979. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.55156910900732478717648524688116855303e-12),
  2980. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.14905040433940475292279950923000597280e-16),
  2981. BOOST_MATH_BIG_CONSTANT(RealType, 113, -7.35237464492052939771487320880614968639e-20),
  2982. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.07937000518607459141766382199896010484e-24),
  2983. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.42797358100745086706362563988598447929e-28),
  2984. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.27871637324128856529004325499921407260e-32),
  2985. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.99553669724530906250814559570819049401e-37),
  2986. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.04272644552406682186928100080598582627e-42),
  2987. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.70093315570856725077212325128817808000e-47),
  2988. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.51767319872105260145583037426067406953e-53),
  2989. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.87159268409640967747617639113346310759e-59),
  2990. };
  2991. BOOST_MATH_STATIC const RealType Q[14] = {
  2992. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  2993. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.45350026842128595165328480395513258721e-3),
  2994. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.30398532102631290226106936127181928207e-7),
  2995. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.45242264812189519858570105609209495630e-10),
  2996. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.22745462510042159972414219082495434039e-14),
  2997. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.31834645038348794443252730265421155969e-17),
  2998. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.44590392528760847619123404904356730177e-21),
  2999. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.08436623062305193311891193246627599030e-25),
  3000. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.46542554766048266351202730449796918707e-30),
  3001. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.78672067064478133389628198943161640913e-34),
  3002. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.56573050761582685018467077197376031818e-39),
  3003. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.92145137276530136848088270840255715047e-44),
  3004. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.96933863894082533505471662180541379922e-49),
  3005. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.92661972206232945959915223259585457082e-55),
  3006. };
  3007. // LCOV_EXCL_STOP
  3008. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  3009. }
  3010. else if (ilogb(p) >= -16384) {
  3011. RealType t = -log2(ldexp(p, 8192));
  3012. // Rational Approximation
  3013. // Maximum Relative Error: 4.8819e-35
  3014. // LCOV_EXCL_START
  3015. BOOST_MATH_STATIC const RealType P[15] = {
  3016. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.24662793339079714510108682543625432532e1),
  3017. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.25841960642102016210295419419373971750e-2),
  3018. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.10589156998251704634852108689102850747e-5),
  3019. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.18697614924486382142056819421294206504e-9),
  3020. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.79445222262445726654186491785652765635e-13),
  3021. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.41847338407338901513049755299049551186e-17),
  3022. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.44550500540299259432401029904726959214e-21),
  3023. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.97463434518480676079167684683604645092e-26),
  3024. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.68404349202062958045327516688040625516e-30),
  3025. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.14018837476359778654965300153810397742e-35),
  3026. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.67726222606571327724434861967972555751e-40),
  3027. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.48082398191886705229604237754446294033e-45),
  3028. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.28534456209055262678153908192583037946e-51),
  3029. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.99466700145428173772768099494881455874e-57),
  3030. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.43473066278196981345209422626769148425e-63),
  3031. };
  3032. BOOST_MATH_STATIC const RealType Q[14] = {
  3033. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3034. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.26570199429958856038191879713341034013e-4),
  3035. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.32484776300757286079244074394356908390e-7),
  3036. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.31234182027812869096733088981702059020e-11),
  3037. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.13711443044675425837293030288097468867e-15),
  3038. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.11480036828082409994688474687120865023e-19),
  3039. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.25592803132287127389756949487347562847e-23),
  3040. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.45726006695535760451195102271978072855e-28),
  3041. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.13082170504731110487003517418453709982e-32),
  3042. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.48217827031663836930337143509338210426e-37),
  3043. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.47389053144555736191304002865419453269e-42),
  3044. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.90980968229123572201281013063229644814e-47),
  3045. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.79448544326289688123648457587797649323e-53),
  3046. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.56179793347045575604935927245529360950e-59),
  3047. };
  3048. // LCOV_EXCL_STOP
  3049. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  3050. }
  3051. else {
  3052. result = -boost::math::numeric_limits<RealType>::infinity();
  3053. }
  3054. return result;
  3055. }
  3056. template <class RealType>
  3057. BOOST_MATH_GPU_ENABLED inline RealType mapairy_quantile_upper_imp_prec(const RealType& p, const boost::math::integral_constant<int, 53>&)
  3058. {
  3059. BOOST_MATH_STD_USING
  3060. RealType result;
  3061. if (p >= 0.25) {
  3062. RealType t = p - static_cast <RealType>(0.25);
  3063. // Rational Approximation
  3064. // Maximum Absolute Error: 1.8559e-18
  3065. BOOST_MATH_STATIC const RealType P[8] = {
  3066. static_cast<RealType>(4.81512108276093785320e-1),
  3067. static_cast<RealType>(-2.74296316128959647914e0),
  3068. static_cast<RealType>(-3.29973875964825685757e1),
  3069. static_cast<RealType>(-4.87536980816224603581e1),
  3070. static_cast<RealType>(8.22233203036734027999e1),
  3071. static_cast<RealType>(1.21654607908452130093e2),
  3072. static_cast<RealType>(-6.66681853240657307279e1),
  3073. static_cast<RealType>(-4.28101952511581488588e1),
  3074. };
  3075. BOOST_MATH_STATIC const RealType Q[10] = {
  3076. static_cast<RealType>(1.),
  3077. static_cast<RealType>(8.20189490825315245036e0),
  3078. static_cast<RealType>(1.63469912146101848441e1),
  3079. static_cast<RealType>(-1.52740920318273920072e1),
  3080. static_cast<RealType>(-5.41684560257839409762e1),
  3081. static_cast<RealType>(6.51733677169299416471e0),
  3082. static_cast<RealType>(3.93092001388102589237e1),
  3083. static_cast<RealType>(-9.59983666140749481195e-1),
  3084. static_cast<RealType>(-9.95648827557655863699e-1),
  3085. static_cast<RealType>(-1.32007124426778083829e0),
  3086. };
  3087. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  3088. }
  3089. else if (p >= 0.125) {
  3090. RealType t = p - static_cast <RealType>(0.125);
  3091. // Rational Approximation
  3092. // Maximum Absolute Error: 4.6019e-17
  3093. BOOST_MATH_STATIC const RealType P[7] = {
  3094. static_cast<RealType>(1.70276979914029733585e0),
  3095. static_cast<RealType>(2.09991992116646276165e1),
  3096. static_cast<RealType>(2.26775403775298867998e1),
  3097. static_cast<RealType>(-4.85384304722129472833e2),
  3098. static_cast<RealType>(-1.47107146466495573999e3),
  3099. static_cast<RealType>(-7.08748473959943943929e1),
  3100. static_cast<RealType>(1.54245210917147215257e3),
  3101. };
  3102. BOOST_MATH_STATIC const RealType Q[8] = {
  3103. static_cast<RealType>(1.),
  3104. static_cast<RealType>(2.13092357122115486375e1),
  3105. static_cast<RealType>(1.57318281834689144053e2),
  3106. static_cast<RealType>(4.42261730187813035957e2),
  3107. static_cast<RealType>(2.10814431586717588454e2),
  3108. static_cast<RealType>(-6.36700983439599552504e2),
  3109. static_cast<RealType>(-2.82923881266630617596e2),
  3110. static_cast<RealType>(1.36613971025062750340e2),
  3111. };
  3112. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  3113. }
  3114. else if (ilogb(p) >= -4) {
  3115. RealType t = -log2(ldexp(p, 3));
  3116. // Rational Approximation
  3117. // Maximum Relative Error: 1.2193e-19
  3118. BOOST_MATH_STATIC const RealType P[8] = {
  3119. static_cast<RealType>(4.25692449785074345588e-1),
  3120. static_cast<RealType>(3.10963501706596356267e-1),
  3121. static_cast<RealType>(2.91357806215297069863e-2),
  3122. static_cast<RealType>(2.34716342676849303244e-2),
  3123. static_cast<RealType>(5.83137296293361915583e-3),
  3124. static_cast<RealType>(3.71792415497884868748e-4),
  3125. static_cast<RealType>(1.59538372221030642757e-4),
  3126. static_cast<RealType>(4.74040834029330213692e-6),
  3127. };
  3128. BOOST_MATH_STATIC const RealType Q[8] = {
  3129. static_cast<RealType>(1.),
  3130. static_cast<RealType>(4.14801234415100707213e-1),
  3131. static_cast<RealType>(1.04693730144480856638e-1),
  3132. static_cast<RealType>(3.81581484862997435076e-2),
  3133. static_cast<RealType>(8.95334009127358617362e-3),
  3134. static_cast<RealType>(1.43316686981760147226e-3),
  3135. static_cast<RealType>(1.81367766024620080990e-4),
  3136. static_cast<RealType>(1.54779999748286671973e-5),
  3137. };
  3138. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3139. }
  3140. else if (ilogb(p) >= -8) {
  3141. RealType t = -log2(ldexp(p, 4));
  3142. // Rational Approximation
  3143. // Maximum Relative Error: 4.4418e-17
  3144. BOOST_MATH_STATIC const RealType P[11] = {
  3145. static_cast<RealType>(5.07341098045260541890e-1),
  3146. static_cast<RealType>(3.11771145411143166935e-1),
  3147. static_cast<RealType>(1.74515601081894060888e-1),
  3148. static_cast<RealType>(8.46576990174024231338e-2),
  3149. static_cast<RealType>(2.57510090204322149315e-2),
  3150. static_cast<RealType>(8.26605326867021684811e-3),
  3151. static_cast<RealType>(1.73081423934722046819e-3),
  3152. static_cast<RealType>(3.36314161099011673569e-4),
  3153. static_cast<RealType>(4.50990441180388912803e-5),
  3154. static_cast<RealType>(4.53513191985642134268e-6),
  3155. static_cast<RealType>(2.62304611053075404923e-7),
  3156. };
  3157. BOOST_MATH_STATIC const RealType Q[11] = {
  3158. static_cast<RealType>(1.),
  3159. static_cast<RealType>(5.28225379952156944029e-1),
  3160. static_cast<RealType>(3.49662079845715371907e-1),
  3161. static_cast<RealType>(1.45408903426879603625e-1),
  3162. static_cast<RealType>(5.06773501409016231879e-2),
  3163. static_cast<RealType>(1.45385556714043243731e-2),
  3164. static_cast<RealType>(3.31235831325018043744e-3),
  3165. static_cast<RealType>(6.06977554525543056050e-4),
  3166. static_cast<RealType>(8.42406730405209749492e-5),
  3167. static_cast<RealType>(8.32337989541696717905e-6),
  3168. static_cast<RealType>(4.84923196546857128337e-7),
  3169. };
  3170. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3171. }
  3172. else if (ilogb(p) >= -16) {
  3173. RealType t = -log2(ldexp(p, 8));
  3174. // Rational Approximation
  3175. // Maximum Relative Error: 5.7932e-17
  3176. BOOST_MATH_STATIC const RealType P[10] = {
  3177. static_cast<RealType>(5.41774626094491510395e-1),
  3178. static_cast<RealType>(4.11060141334529017898e-1),
  3179. static_cast<RealType>(1.48195601801946264526e-1),
  3180. static_cast<RealType>(3.33881552814492855873e-2),
  3181. static_cast<RealType>(5.20893974732203890418e-3),
  3182. static_cast<RealType>(5.84734765774178832854e-4),
  3183. static_cast<RealType>(4.71028150898133935445e-5),
  3184. static_cast<RealType>(2.59185739450631464618e-6),
  3185. static_cast<RealType>(7.77428184258777394627e-8),
  3186. static_cast<RealType>(2.51255632629650930196e-14),
  3187. };
  3188. BOOST_MATH_STATIC const RealType Q[9] = {
  3189. static_cast<RealType>(1.),
  3190. static_cast<RealType>(7.58341767924960527280e-1),
  3191. static_cast<RealType>(2.73511775500642961539e-1),
  3192. static_cast<RealType>(6.16011987856129890130e-2),
  3193. static_cast<RealType>(9.61296002312356116021e-3),
  3194. static_cast<RealType>(1.07890675777726076554e-3),
  3195. static_cast<RealType>(8.69223632953458271977e-5),
  3196. static_cast<RealType>(4.78248875031756169279e-6),
  3197. static_cast<RealType>(1.43460852065144859304e-7),
  3198. };
  3199. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3200. }
  3201. else if (ilogb(p) >= -32) {
  3202. RealType t = -log2(ldexp(p, 16));
  3203. // Rational Approximation
  3204. // Maximum Relative Error: 9.0396e-17
  3205. BOOST_MATH_STATIC const RealType P[9] = {
  3206. static_cast<RealType>(5.41926067826974905066e-1),
  3207. static_cast<RealType>(4.86926556246548518715e-1),
  3208. static_cast<RealType>(2.11963908288176005856e-1),
  3209. static_cast<RealType>(5.92200639925655576883e-2),
  3210. static_cast<RealType>(1.18859816815542567438e-2),
  3211. static_cast<RealType>(1.76833662992855443754e-3),
  3212. static_cast<RealType>(2.21226152157950219596e-4),
  3213. static_cast<RealType>(1.50444847316426133872e-5),
  3214. static_cast<RealType>(1.87458213915373906356e-6),
  3215. };
  3216. BOOST_MATH_STATIC const RealType Q[9] = {
  3217. static_cast<RealType>(1.),
  3218. static_cast<RealType>(8.98511036742503939380e-1),
  3219. static_cast<RealType>(3.91130673008184655152e-1),
  3220. static_cast<RealType>(1.09277016228474605069e-1),
  3221. static_cast<RealType>(2.19328471889880028208e-2),
  3222. static_cast<RealType>(3.26305879571349016107e-3),
  3223. static_cast<RealType>(4.08222014684743492069e-4),
  3224. static_cast<RealType>(2.77611385768697969181e-5),
  3225. static_cast<RealType>(3.45911046256304795257e-6),
  3226. };
  3227. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3228. }
  3229. else {
  3230. RealType p_square = p * p;
  3231. if ((boost::math::isnormal)(p_square)) {
  3232. result = 1 / cbrt(p_square * constants::two_pi<RealType>());
  3233. }
  3234. else if (p > 0) {
  3235. result = 1 / (cbrt(p) * cbrt(p) * cbrt(constants::two_pi<RealType>()));
  3236. }
  3237. else {
  3238. result = boost::math::numeric_limits<RealType>::infinity();
  3239. }
  3240. }
  3241. return result;
  3242. }
  3243. template <class RealType>
  3244. BOOST_MATH_GPU_ENABLED inline RealType mapairy_quantile_upper_imp_prec(const RealType& p, const boost::math::integral_constant<int, 113>&)
  3245. {
  3246. BOOST_MATH_STD_USING
  3247. RealType result;
  3248. if (p >= 0.375) {
  3249. RealType t = p - static_cast <RealType>(0.375);
  3250. // Rational Approximation
  3251. // Maximum Absolute Error: 4.0835e-35
  3252. // LCOV_EXCL_START
  3253. BOOST_MATH_STATIC const RealType P[13] = {
  3254. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.00474815142578902619056852805926666121e-1),
  3255. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.56422290947427848191079775267512708223e0),
  3256. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.70103710180837859003070678080056933649e1),
  3257. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.08521918131449191445864593768320217287e1),
  3258. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.29340655781369686013042530147130581054e2),
  3259. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.24198237124638368989049118891909723118e1),
  3260. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.43382878809828906953609389440800537385e2),
  3261. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.45564809127564867825118566276365267035e1),
  3262. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.75881247317499884393790698530115428373e2),
  3263. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.55845932095942777602241134226597158364e1),
  3264. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.41328261385867825781522154621962338450e2),
  3265. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.06758225510372847658316203115073730186e1),
  3266. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.10895417312529385966062255102265009972e0),
  3267. };
  3268. BOOST_MATH_STATIC const RealType Q[12] = {
  3269. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3270. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.88252553879196710256650370298744093367e0),
  3271. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.54875259600848880869571364891152935969e0),
  3272. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.78589587338618424770295921221996471887e1),
  3273. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.15356831947775532414727361010652423453e1),
  3274. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.12951532118504570745988981200579372124e2),
  3275. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.48163841544376327168780999614703092433e1),
  3276. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.56786609618056303930232548304847911521e2),
  3277. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.25610739352108840474197350343978451729e1),
  3278. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.27063786175330237448255839666252978603e1),
  3279. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.11941093895004369510720986032269722254e0),
  3280. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.51487618026728514833542002963603231101e1),
  3281. };
  3282. // LCOV_EXCL_STOP
  3283. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  3284. }
  3285. else if (p >= 0.25) {
  3286. RealType t = p - static_cast <RealType>(0.25);
  3287. // Rational Approximation
  3288. // Maximum Absolute Error: 5.7633e-36
  3289. // LCOV_EXCL_START
  3290. BOOST_MATH_STATIC const RealType P[14] = {
  3291. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.81512108276093787175849069715334402323e-1),
  3292. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.24417080443497141096829831516758083481e0),
  3293. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.67006165991083501886186268944009973084e1),
  3294. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.74402382755828993223083868408545308340e2),
  3295. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.49182541725192134610277727922493871787e2),
  3296. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.67273564707254788337557775618297381267e1),
  3297. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.73476432616329813096120568871900178919e3),
  3298. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.31235376166262024838125198332476698090e3),
  3299. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.59379285677781413393733801325840617522e3),
  3300. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.38151434050794836595564739176884302539e3),
  3301. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.33534676810383673962443893459127818078e3),
  3302. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.38110822236764293910895765875742805411e3),
  3303. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.42750073722992463087082849671338957023e2),
  3304. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.54255748148299874514839812717054396793e2),
  3305. };
  3306. BOOST_MATH_STATIC const RealType Q[13] = {
  3307. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3308. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.64823387375875361292425741663822893626e1),
  3309. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.02973633484731117050245517938177308809e2),
  3310. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.71288209768693917630236009171518272534e2),
  3311. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.23837527610546426062625864735895938014e1),
  3312. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.05056816585729983223036277071927165555e3),
  3313. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.48087477651935811184913947280572029967e3),
  3314. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.04631058325147527913398256133791276127e3),
  3315. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.69813394441679590721342220435891453447e3),
  3316. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.92323371456465893290687995174952942311e2),
  3317. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.68542430563281320943284015587559056621e3),
  3318. BOOST_MATH_BIG_CONSTANT(RealType, 113, -4.17969051793607842221356465819951568080e1),
  3319. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.82773308760283383020168853159163391394e2),
  3320. };
  3321. // LCOV_EXCL_STOP
  3322. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  3323. }
  3324. else if (p >= 0.125) {
  3325. RealType t = p - static_cast <RealType>(0.125);
  3326. // Rational Approximation
  3327. // Maximum Absolute Error: 2.1140e-36
  3328. // LCOV_EXCL_START
  3329. BOOST_MATH_STATIC const RealType P[15] = {
  3330. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.70276979914029738186601698003670175907e0),
  3331. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.63126762626382548478172664328434577553e1),
  3332. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.04190225271045202674546813475341133174e3),
  3333. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.93523974140998850492859698545966806498e3),
  3334. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.19814006186501010136822066747124777014e4),
  3335. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.55931423620290859807616748030589502039e4),
  3336. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.78874021192395317496507459296221703565e5),
  3337. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.03860533237347587977439662522389465152e6),
  3338. BOOST_MATH_BIG_CONSTANT(RealType, 113, -2.77882648875352690605815508748162607271e6),
  3339. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.05498612167816258406694194925933958145e6),
  3340. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.05326361485692298778330190198630232666e7),
  3341. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.85827791876754731187453265804790139032e5),
  3342. BOOST_MATH_BIG_CONSTANT(RealType, 113, -8.93719378006868242377955041137674308589e6),
  3343. BOOST_MATH_BIG_CONSTANT(RealType, 113, -5.56839957539576784391036362196229047625e5),
  3344. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.95604329277359828898502487252547842378e6),
  3345. };
  3346. BOOST_MATH_STATIC const RealType Q[16] = {
  3347. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3348. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.79208640567193066236912382037923299779e1),
  3349. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.94775812217734059201656828286490832145e2),
  3350. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.16467934643564936346029555887148320030e4),
  3351. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.35525720248600096849901920839060920346e4),
  3352. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.69760913594243328874861534307039589127e5),
  3353. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.32330501005950982838953061458838040612e5),
  3354. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.79610639577090112327353399739315606205e5),
  3355. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.43314292923292828425630915931385776182e6),
  3356. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.97538885038058371436244702169375622661e6),
  3357. BOOST_MATH_BIG_CONSTANT(RealType, 113, -9.48431896958634429210349441846613832681e5),
  3358. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.93459449030820736960297236799012798749e6),
  3359. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.67200014823529787381847745962773726408e6),
  3360. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.37035571075060153491151970623824940994e6),
  3361. BOOST_MATH_BIG_CONSTANT(RealType, 113, -3.22682822001329636071591164177026394518e5),
  3362. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.09781406768816062486819491582960840983e4),
  3363. };
  3364. // LCOV_EXCL_STOP
  3365. result = tools::evaluate_polynomial(P, t) / tools::evaluate_polynomial(Q, t);
  3366. }
  3367. else if (ilogb(p) >= -4) {
  3368. RealType t = -log2(ldexp(p, 3));
  3369. // Rational Approximation
  3370. // Maximum Relative Error: 1.1409e-35
  3371. // LCOV_EXCL_START
  3372. BOOST_MATH_STATIC const RealType P[14] = {
  3373. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.25692449785074345466504245009175450649e-1),
  3374. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.75679137667345136118441108839649360362e-1),
  3375. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.06171803174020856964914440692439080669e-2),
  3376. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.87798066278592051163038122952593080648e-2),
  3377. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.20070543183347459409303407166630392077e-2),
  3378. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.13457391270614708627745403376469848816e-4),
  3379. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.06743974464224003715510181633693539914e-3),
  3380. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.16870984737226212814217822779976770316e-4),
  3381. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.21845093091651861426944931268861694026e-5),
  3382. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.85357146081877929591916782097540632519e-6),
  3383. BOOST_MATH_BIG_CONSTANT(RealType, 113, -6.19085800299127898508052519062782284785e-8),
  3384. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.41985644250494046067095909812634573318e-7),
  3385. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.30857042700765443668305406695750760693e-9),
  3386. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.10466412567107519640190849286913680449e-10),
  3387. };
  3388. BOOST_MATH_STATIC const RealType Q[14] = {
  3389. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3390. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.31914248618040435028023418981527961171e-1),
  3391. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.73578090645412656850163531828709850171e-2),
  3392. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.57329813782272411333511950903192234311e-2),
  3393. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.62736127875896578315177123764520823372e-2),
  3394. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.76809643836078823237530990091078867553e-3),
  3395. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.32026948719622983920194944841520771986e-3),
  3396. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.45051018027743807545734050620973716634e-4),
  3397. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.58281707210621813556068724127478674938e-5),
  3398. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.63884527227517358294732620995363921547e-6),
  3399. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.15973602356223075515067915930205826229e-6),
  3400. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.35069439950884795002182517078104942615e-7),
  3401. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.15454119109586223908613596754794988609e-8),
  3402. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.55273685376557721039847456564342945576e-10),
  3403. };
  3404. // LCOV_EXCL_STOP
  3405. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3406. }
  3407. else if (ilogb(p) >= -8) {
  3408. RealType t = -log2(ldexp(p, 4));
  3409. // Rational Approximation
  3410. // Maximum Relative Error: 1.2521e-35
  3411. // LCOV_EXCL_START
  3412. BOOST_MATH_STATIC const RealType P[23] = {
  3413. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.07341098045260497471001948654506267614e-1),
  3414. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.16518383383878659278973043343250842753e-1),
  3415. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.10029094208424121908983949243560936013e-1),
  3416. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.04771840726172284780129819470963100749e-2),
  3417. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.34173170868011689830672637082451998700e-2),
  3418. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.41990262178664512140746911398264330173e-2),
  3419. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.06779488545758366708787010705581103705e-3),
  3420. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.41892665233583725631482443019441608726e-3),
  3421. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.20692306716979208762785454648538891867e-4),
  3422. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.11097906809673639231336894729060830995e-4),
  3423. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.37476591232600886363441107536706973169e-5),
  3424. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.02659053066396720145189153810309784416e-5),
  3425. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.02209877191642023279303996697953314344e-6),
  3426. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.56663781532392665205516573323950583901e-7),
  3427. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.95655734237060800145227277584749429063e-7),
  3428. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.06357695252098035545383649954315685077e-8),
  3429. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.78759045059235560356343893064681290047e-9),
  3430. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.95881339136963512103591745337914059651e-10),
  3431. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.70156441275519927563064848389865812060e-11),
  3432. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.99745225746277063516394774908346367811e-12),
  3433. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.45718440382347867317547921045052714102e-13),
  3434. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.39027665085346558512961348663034579801e-14),
  3435. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.05739751797738770096482688062542436470e-15),
  3436. };
  3437. BOOST_MATH_STATIC const RealType Q[23] = {
  3438. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3439. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.43370372582239919321785765900615222895e-1),
  3440. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.52872159582703775260145036441128318159e-1),
  3441. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.28243735290178057451806192890274584778e-1),
  3442. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.93375398009812888642212045868197435998e-2),
  3443. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.73364866677217419593129631900708646445e-2),
  3444. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.53645928499107852437053167521160449434e-2),
  3445. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.74280939589407863107682593092148442428e-3),
  3446. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.80095449855178765594835180574448729793e-3),
  3447. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.65924845456946706158946250220103271334e-4),
  3448. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.52170861715436344002253767944763106994e-4),
  3449. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.87246437551620484806338690322735878649e-5),
  3450. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.88631873230311653853089809596759382095e-6),
  3451. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.84478812152918182782333415475103623486e-6),
  3452. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.47998768403859674841488325856607782853e-7),
  3453. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.82364683269852480160620586102339743788e-8),
  3454. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.65854316058742127585142691993199177898e-9),
  3455. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.11358340340462071552670838135645042498e-9),
  3456. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.22818744671190957896035448856159685984e-10),
  3457. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.11038729491846772238262374112315536796e-11),
  3458. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.21355801166652957655438257794658921155e-13),
  3459. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.41278271853370874105923461404291742454e-14),
  3460. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.95100373579692323015092323646110838623e-15),
  3461. };
  3462. // LCOV_EXCL_STOP
  3463. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3464. }
  3465. else if (ilogb(p) >= -16) {
  3466. RealType t = -log2(ldexp(p, 8));
  3467. // Rational Approximation
  3468. // Maximum Relative Error: 2.0703e-35
  3469. // LCOV_EXCL_START
  3470. BOOST_MATH_STATIC const RealType P[21] = {
  3471. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.41774626094491452462664949805613444094e-1),
  3472. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.96383089261273022706449773421031102175e-1),
  3473. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.16315295073029174376617863024082371446e-1),
  3474. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.65377894193914426949840018839915119410e-1),
  3475. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.33210993830236821503160637845009556016e-1),
  3476. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.69315463529653886947182738378630780083e-2),
  3477. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.09869947341518160436616160018702590834e-3),
  3478. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.44331691052908906654005398143769791881e-3),
  3479. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.13131413925652085071882765653750661678e-4),
  3480. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.64441840437413591336927030249538399459e-5),
  3481. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.78393581596372725434038621824715039765e-6),
  3482. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.50239319821178575427758224587858938204e-7),
  3483. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.92619647697287767235953207451871137149e-8),
  3484. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.26901081456833267780600560830367533351e-9),
  3485. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.12151768312254597726918329997945574766e-11),
  3486. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.36907507996686107513673694597817437197e-12),
  3487. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.31699373909892506279113260845246144240e-13),
  3488. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.11230682511893290562864133995544214588e-15),
  3489. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.44627067257461788044784631155226503036e-17),
  3490. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.39869585157420474301450400944478312794e-18),
  3491. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.82128612844034824876694595066123093042e-27),
  3492. };
  3493. BOOST_MATH_STATIC const RealType Q[20] = {
  3494. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3495. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.65414405277042133067228113526697909557e0),
  3496. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.32179221250476209346757936207079534440e0),
  3497. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.74217392682100275524983756207618144313e-1),
  3498. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.45810448055940046896534973720645113799e-1),
  3499. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.81487408603233765436807980794697048675e-2),
  3500. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.49442843848941402948883852684502731460e-2),
  3501. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.66330842256792791665907478718489013963e-3),
  3502. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.93285292223845804061941359223505045576e-4),
  3503. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.87966347754794288681626114849829710697e-5),
  3504. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.13711644429711675111080150193733607164e-6),
  3505. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.61758862007482013187806625777101452737e-7),
  3506. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.55435556106272558989915248980090731639e-8),
  3507. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.34166571320580242213843747025082914011e-9),
  3508. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.31411360099525131959755145015018410429e-10),
  3509. BOOST_MATH_BIG_CONSTANT(RealType, 113, 6.21684839228785650625270026640716752452e-12),
  3510. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.43021096301255274530428188746599779008e-13),
  3511. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.58831290247776456235908211620983180005e-15),
  3512. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.74309280855806399632683315923592902203e-16),
  3513. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.58097100528573186098159133443927182780e-18),
  3514. };
  3515. // LCOV_EXCL_STOP
  3516. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3517. }
  3518. else if (ilogb(p) >= -32) {
  3519. RealType t = -log2(ldexp(p, 16));
  3520. // Rational Approximation
  3521. // Maximum Relative Error: 3.4124e-35
  3522. // LCOV_EXCL_START
  3523. BOOST_MATH_STATIC const RealType P[19] = {
  3524. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.41926067826974814669251179264786585885e-1),
  3525. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.21141529920003643675474888047093566280e-1),
  3526. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.59964592861304582755436075901659426485e-1),
  3527. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.95135112971576806260593571877646426022e-2),
  3528. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.12322024725362032809787183337883163254e-3),
  3529. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.96758465518847580191799508363466893068e-4),
  3530. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.12389553946694902774213055563291192175e-4),
  3531. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.04599236076217479033545023949602272721e-5),
  3532. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.16143771174487665823565565218797804931e-7),
  3533. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.38966874413947625866830582082846088427e-8),
  3534. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.02590325514935982607907975481732376204e-9),
  3535. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.44376747400143802055827426602151525955e-10),
  3536. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.82088624006657184426589019067893704020e-12),
  3537. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.95757210706845964048697237729100056232e-13),
  3538. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.36096213291559182424937062842308387702e-15),
  3539. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.14362780521873256616533770657488533993e-16),
  3540. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.73571098395815275003552523759665474105e-18),
  3541. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.47286214854389274681661944885238913581e-20),
  3542. BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.73701196181204039400706651811524874455e-34),
  3543. };
  3544. BOOST_MATH_STATIC const RealType Q[18] = {
  3545. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3546. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.77119890916406072259446489508263892540e-1),
  3547. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.95177888809731859578167185583119074026e-1),
  3548. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.29131027214559081111011582466619105016e-2),
  3549. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.31442657037887347262737789825299661237e-2),
  3550. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.83928863984637222329515960387531101267e-3),
  3551. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.07389089078167127136964851949662391744e-4),
  3552. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.93013847797006474150589676891548600820e-5),
  3553. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.50600573851533884594030683413819219915e-6),
  3554. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.94539484213971921794449107859541806317e-8),
  3555. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.58360895032645281635534287874266252341e-9),
  3556. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.66414102108217999886628042310332365446e-10),
  3557. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.07411076181287950822375436854492998754e-11),
  3558. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.61224937285582228022463072515935601355e-13),
  3559. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.89242339209389981530783624934733098598e-15),
  3560. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.11030225010379194015550512905872992373e-16),
  3561. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.20285566539355859922818448335043495666e-18),
  3562. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.71782855576364068752705740544460766362e-20),
  3563. };
  3564. // LCOV_EXCL_STOP
  3565. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3566. }
  3567. else if (ilogb(p) >= -64) {
  3568. RealType t = -log2(ldexp(p, 32));
  3569. // Rational Approximation
  3570. // Maximum Relative Error: 2.1680e-35
  3571. // LCOV_EXCL_START
  3572. BOOST_MATH_STATIC const RealType P[18] = {
  3573. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.41926070139289008206183757488364846894e-1),
  3574. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.78434820569480998586988738136492447574e-1),
  3575. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.07939171933509333571821660328723436210e-1),
  3576. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.92438439347811482522082798370060349739e-2),
  3577. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.24288918322433485413615362874371441367e-2),
  3578. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.04437759300344740815274986587186340509e-3),
  3579. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.74063952231188399929705762263485071234e-4),
  3580. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.07228849610363181194047955109059900544e-5),
  3581. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.93120850707001212714821992328252707694e-6),
  3582. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.40911049607879914351205073608184243057e-7),
  3583. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.71898232013947717725198847649536278438e-8),
  3584. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.06963706982203753050300400912657068823e-9),
  3585. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.79849166632277658631839126599110199710e-11),
  3586. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.74682085785152276503345630444792840850e-12),
  3587. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.09650236336641219916377836114077389212e-13),
  3588. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.97326394822836529817663710792553753811e-15),
  3589. BOOST_MATH_BIG_CONSTANT(RealType, 113, 9.26635728806398747570910072594323836441e-17),
  3590. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.96470010392255781222480229189380065951e-18),
  3591. };
  3592. BOOST_MATH_STATIC const RealType Q[18] = {
  3593. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.),
  3594. BOOST_MATH_BIG_CONSTANT(RealType, 113, 8.82841492468725267177870050157374330523e-1),
  3595. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.83703946702662950408034486958999188355e-1),
  3596. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.09320896703777230915306208582393356690e-1),
  3597. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.29346630787642344947323515884281464979e-2),
  3598. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.77242894492599243245354774839232776944e-3),
  3599. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.05722029871614922850936250945431594997e-4),
  3600. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.66920224988248720006255827987385374411e-5),
  3601. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.40887155754772190509572243444386095560e-6),
  3602. BOOST_MATH_BIG_CONSTANT(RealType, 113, 4.44545968319921473942351968892623238920e-7),
  3603. BOOST_MATH_BIG_CONSTANT(RealType, 113, 3.17198676140022989760684932594389017027e-8),
  3604. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.97376935482567419865730773801543995320e-9),
  3605. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.06997835790265899882151030367297786861e-10),
  3606. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.06862653266619706928282319356971834957e-12),
  3607. BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.02334307903766790059473763725329176667e-13),
  3608. BOOST_MATH_BIG_CONSTANT(RealType, 113, 7.33174535634931487079630169746402085699e-15),
  3609. BOOST_MATH_BIG_CONSTANT(RealType, 113, 1.70989324903345102377898775620363767855e-16),
  3610. BOOST_MATH_BIG_CONSTANT(RealType, 113, 5.47067260145014475572799216996976703615e-18),
  3611. };
  3612. // LCOV_EXCL_STOP
  3613. result = tools::evaluate_polynomial(P, t) / (tools::evaluate_polynomial(Q, t) * cbrt(p * p));
  3614. }
  3615. else {
  3616. RealType p_square = p * p;
  3617. if ((boost::math::isnormal)(p_square)) {
  3618. result = 1 / cbrt(p_square * constants::two_pi<RealType>());
  3619. }
  3620. else if (p > 0) {
  3621. result = 1 / (cbrt(p) * cbrt(p) * cbrt(constants::two_pi<RealType>()));
  3622. }
  3623. else {
  3624. result = boost::math::numeric_limits<RealType>::infinity();
  3625. }
  3626. }
  3627. return result;
  3628. }
  3629. template <class RealType>
  3630. BOOST_MATH_GPU_ENABLED inline RealType mapairy_quantile_imp_prec(const RealType& p, bool complement, const boost::math::integral_constant<int, 53>& tag)
  3631. {
  3632. if (p > 0.5) {
  3633. return !complement ? mapairy_quantile_upper_imp_prec(1 - p, tag) : mapairy_quantile_lower_imp_prec(1 - p, tag);
  3634. }
  3635. return complement ? mapairy_quantile_upper_imp_prec(p, tag) : mapairy_quantile_lower_imp_prec(p, tag);
  3636. }
  3637. template <class RealType>
  3638. BOOST_MATH_GPU_ENABLED inline RealType mapairy_quantile_imp_prec(const RealType& p, bool complement, const boost::math::integral_constant<int, 113>& tag)
  3639. {
  3640. if (p > 0.5) {
  3641. return !complement ? mapairy_quantile_upper_imp_prec(1 - p, tag) : mapairy_quantile_lower_imp_prec(1 - p, tag);
  3642. }
  3643. return complement ? mapairy_quantile_upper_imp_prec(p, tag) : mapairy_quantile_lower_imp_prec(p, tag);
  3644. }
  3645. template <class RealType, class Policy>
  3646. BOOST_MATH_GPU_ENABLED inline RealType mapairy_quantile_imp(const mapairy_distribution<RealType, Policy>& dist, const RealType& p, bool complement)
  3647. {
  3648. // This routine implements the quantile for the Map-Airy distribution,
  3649. // the value p may be the probability, or its complement if complement=true.
  3650. constexpr auto function = "boost::math::quantile(mapairy<%1%>&, %1%)";
  3651. BOOST_MATH_STD_USING // for ADL of std functions
  3652. RealType result = 0;
  3653. RealType scale = dist.scale();
  3654. RealType location = dist.location();
  3655. if (false == detail::check_location(function, location, &result, Policy()))
  3656. {
  3657. return result;
  3658. }
  3659. if (false == detail::check_scale(function, scale, &result, Policy()))
  3660. {
  3661. return result;
  3662. }
  3663. if (false == detail::check_probability(function, p, &result, Policy()))
  3664. {
  3665. return result;
  3666. }
  3667. typedef typename tools::promote_args<RealType>::type result_type;
  3668. typedef typename policies::precision<result_type, Policy>::type precision_type;
  3669. typedef boost::math::integral_constant<int,
  3670. precision_type::value <= 0 ? 0 :
  3671. precision_type::value <= 53 ? 53 :
  3672. precision_type::value <= 113 ? 113 : 0
  3673. > tag_type;
  3674. static_assert(tag_type::value, "The Map-Airy distribution is only implemented for types with known precision, and 113 bits or fewer in the mantissa (ie 128 bit quad-floats");
  3675. result = location + scale * mapairy_quantile_imp_prec(p, complement, tag_type());
  3676. return result;
  3677. }
  3678. template <class RealType>
  3679. BOOST_MATH_GPU_ENABLED inline RealType mapairy_mode_imp_prec(const boost::math::integral_constant<int, 53>&)
  3680. {
  3681. return static_cast<RealType>(-1.16158727113597068525);
  3682. }
  3683. template <class RealType>
  3684. BOOST_MATH_GPU_ENABLED inline RealType mapairy_mode_imp_prec(const boost::math::integral_constant<int, 113>&)
  3685. {
  3686. return BOOST_MATH_BIG_CONSTANT(RealType, 113, -1.1615872711359706852500000803029112987);
  3687. }
  3688. template <class RealType, class Policy>
  3689. BOOST_MATH_GPU_ENABLED inline RealType mapairy_mode_imp(const mapairy_distribution<RealType, Policy>& dist)
  3690. {
  3691. // This implements the mode for the Map-Airy distribution,
  3692. constexpr auto function = "boost::math::mode(mapairy<%1%>&, %1%)";
  3693. BOOST_MATH_STD_USING // for ADL of std functions
  3694. RealType result = 0;
  3695. RealType scale = dist.scale();
  3696. RealType location = dist.location();
  3697. if (false == detail::check_location(function, location, &result, Policy()))
  3698. {
  3699. return result;
  3700. }
  3701. if (false == detail::check_scale(function, scale, &result, Policy()))
  3702. {
  3703. return result;
  3704. }
  3705. typedef typename tools::promote_args<RealType>::type result_type;
  3706. typedef typename policies::precision<result_type, Policy>::type precision_type;
  3707. typedef boost::math::integral_constant<int,
  3708. precision_type::value <= 0 ? 0 :
  3709. precision_type::value <= 53 ? 53 :
  3710. precision_type::value <= 113 ? 113 : 0
  3711. > tag_type;
  3712. static_assert(tag_type::value, "The Map-Airy distribution is only implemented for types with known precision, and 113 bits or fewer in the mantissa (ie 128 bit quad-floats");
  3713. result = location + scale * mapairy_mode_imp_prec<RealType>(tag_type());
  3714. return result;
  3715. }
  3716. template <class RealType>
  3717. BOOST_MATH_GPU_ENABLED inline RealType mapairy_median_imp_prec(const boost::math::integral_constant<int, 53>&)
  3718. {
  3719. return static_cast<RealType>(-0.71671068545502205332);
  3720. }
  3721. template <class RealType>
  3722. BOOST_MATH_GPU_ENABLED inline RealType mapairy_median_imp_prec(const boost::math::integral_constant<int, 113>&)
  3723. {
  3724. return BOOST_MATH_BIG_CONSTANT(RealType, 113, -0.71671068545502205331700196278067230944440);
  3725. }
  3726. template <class RealType, class Policy>
  3727. BOOST_MATH_GPU_ENABLED inline RealType mapairy_median_imp(const mapairy_distribution<RealType, Policy>& dist)
  3728. {
  3729. // This implements the median for the Map-Airy distribution,
  3730. constexpr auto function = "boost::math::median(mapairy<%1%>&, %1%)";
  3731. BOOST_MATH_STD_USING // for ADL of std functions
  3732. RealType result = 0;
  3733. RealType scale = dist.scale();
  3734. RealType location = dist.location();
  3735. if (false == detail::check_location(function, location, &result, Policy()))
  3736. {
  3737. return result;
  3738. }
  3739. if (false == detail::check_scale(function, scale, &result, Policy()))
  3740. {
  3741. return result;
  3742. }
  3743. typedef typename tools::promote_args<RealType>::type result_type;
  3744. typedef typename policies::precision<result_type, Policy>::type precision_type;
  3745. typedef boost::math::integral_constant<int,
  3746. precision_type::value <= 0 ? 0 :
  3747. precision_type::value <= 53 ? 53 :
  3748. precision_type::value <= 113 ? 113 : 0
  3749. > tag_type;
  3750. static_assert(tag_type::value, "The Map-Airy distribution is only implemented for types with known precision, and 113 bits or fewer in the mantissa (ie 128 bit quad-floats");
  3751. result = location + scale * mapairy_median_imp_prec<RealType>(tag_type());
  3752. return result;
  3753. }
  3754. template <class RealType>
  3755. BOOST_MATH_GPU_ENABLED inline RealType mapairy_entropy_imp_prec(const boost::math::integral_constant<int, 53>&)
  3756. {
  3757. return static_cast<RealType>(2.00727681841065634600);
  3758. }
  3759. template <class RealType>
  3760. BOOST_MATH_GPU_ENABLED inline RealType mapairy_entropy_imp_prec(const boost::math::integral_constant<int, 113>&)
  3761. {
  3762. return BOOST_MATH_BIG_CONSTANT(RealType, 113, 2.0072768184106563460003025875575283708);
  3763. }
  3764. template <class RealType, class Policy>
  3765. BOOST_MATH_GPU_ENABLED inline RealType mapairy_entropy_imp(const mapairy_distribution<RealType, Policy>& dist)
  3766. {
  3767. // This implements the entropy for the Map-Airy distribution,
  3768. constexpr auto function = "boost::math::entropy(mapairy<%1%>&, %1%)";
  3769. BOOST_MATH_STD_USING // for ADL of std functions
  3770. RealType result = 0;
  3771. RealType scale = dist.scale();
  3772. if (false == detail::check_scale(function, scale, &result, Policy()))
  3773. {
  3774. return result;
  3775. }
  3776. typedef typename tools::promote_args<RealType>::type result_type;
  3777. typedef typename policies::precision<result_type, Policy>::type precision_type;
  3778. typedef boost::math::integral_constant<int,
  3779. precision_type::value <= 0 ? 0 :
  3780. precision_type::value <= 53 ? 53 :
  3781. precision_type::value <= 113 ? 113 : 0
  3782. > tag_type;
  3783. static_assert(tag_type::value, "The Map-Airy distribution is only implemented for types with known precision, and 113 bits or fewer in the mantissa (ie 128 bit quad-floats");
  3784. result = mapairy_entropy_imp_prec<RealType>(tag_type()) + log(scale);
  3785. return result;
  3786. }
  3787. } // detail
  3788. template <class RealType = double, class Policy = policies::policy<> >
  3789. class mapairy_distribution
  3790. {
  3791. public:
  3792. typedef RealType value_type;
  3793. typedef Policy policy_type;
  3794. BOOST_MATH_GPU_ENABLED mapairy_distribution(RealType l_location = 0, RealType l_scale = 1)
  3795. : mu(l_location), c(l_scale)
  3796. {
  3797. constexpr auto function = "boost::math::mapairy_distribution<%1%>::mapairy_distribution";
  3798. RealType result = 0;
  3799. detail::check_location(function, l_location, &result, Policy());
  3800. detail::check_scale(function, l_scale, &result, Policy());
  3801. } // mapairy_distribution
  3802. BOOST_MATH_GPU_ENABLED RealType location()const
  3803. {
  3804. return mu;
  3805. }
  3806. BOOST_MATH_GPU_ENABLED RealType scale()const
  3807. {
  3808. return c;
  3809. }
  3810. private:
  3811. RealType mu; // The location parameter.
  3812. RealType c; // The scale parameter.
  3813. };
  3814. typedef mapairy_distribution<double> mapairy;
  3815. #ifdef __cpp_deduction_guides
  3816. template <class RealType>
  3817. mapairy_distribution(RealType) -> mapairy_distribution<typename boost::math::tools::promote_args<RealType>::type>;
  3818. template <class RealType>
  3819. mapairy_distribution(RealType, RealType) -> mapairy_distribution<typename boost::math::tools::promote_args<RealType>::type>;
  3820. #endif
  3821. template <class RealType, class Policy>
  3822. BOOST_MATH_GPU_ENABLED inline const boost::math::pair<RealType, RealType> range(const mapairy_distribution<RealType, Policy>&)
  3823. { // Range of permissible values for random variable x.
  3824. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits<RealType>::has_infinity)
  3825. {
  3826. return boost::math::pair<RealType, RealType>(-boost::math::numeric_limits<RealType>::infinity(), boost::math::numeric_limits<RealType>::infinity()); // - to + infinity.
  3827. }
  3828. else
  3829. { // Can only use max_value.
  3830. using boost::math::tools::max_value;
  3831. return boost::math::pair<RealType, RealType>(-max_value<RealType>(), max_value<RealType>()); // - to + max.
  3832. }
  3833. }
  3834. template <class RealType, class Policy>
  3835. BOOST_MATH_GPU_ENABLED inline const boost::math::pair<RealType, RealType> support(const mapairy_distribution<RealType, Policy>&)
  3836. { // Range of supported values for random variable x.
  3837. // This is range where cdf rises from 0 to 1, and outside it, the pdf is zero.
  3838. BOOST_MATH_IF_CONSTEXPR (boost::math::numeric_limits<RealType>::has_infinity)
  3839. {
  3840. return boost::math::pair<RealType, RealType>(-boost::math::numeric_limits<RealType>::infinity(), boost::math::numeric_limits<RealType>::infinity()); // - to + infinity.
  3841. }
  3842. else
  3843. { // Can only use max_value.
  3844. using boost::math::tools::max_value;
  3845. return boost::math::pair<RealType, RealType>(-tools::max_value<RealType>(), max_value<RealType>()); // - to + max.
  3846. }
  3847. }
  3848. template <class RealType, class Policy>
  3849. BOOST_MATH_GPU_ENABLED inline RealType pdf(const mapairy_distribution<RealType, Policy>& dist, const RealType& x)
  3850. {
  3851. return detail::mapairy_pdf_imp(dist, x);
  3852. } // pdf
  3853. template <class RealType, class Policy>
  3854. BOOST_MATH_GPU_ENABLED inline RealType cdf(const mapairy_distribution<RealType, Policy>& dist, const RealType& x)
  3855. {
  3856. return detail::mapairy_cdf_imp(dist, x, false);
  3857. } // cdf
  3858. template <class RealType, class Policy>
  3859. BOOST_MATH_GPU_ENABLED inline RealType quantile(const mapairy_distribution<RealType, Policy>& dist, const RealType& p)
  3860. {
  3861. return detail::mapairy_quantile_imp(dist, p, false);
  3862. } // quantile
  3863. template <class RealType, class Policy>
  3864. BOOST_MATH_GPU_ENABLED inline RealType cdf(const complemented2_type<mapairy_distribution<RealType, Policy>, RealType>& c)
  3865. {
  3866. return detail::mapairy_cdf_imp(c.dist, c.param, true);
  3867. } // cdf complement
  3868. template <class RealType, class Policy>
  3869. BOOST_MATH_GPU_ENABLED inline RealType quantile(const complemented2_type<mapairy_distribution<RealType, Policy>, RealType>& c)
  3870. {
  3871. return detail::mapairy_quantile_imp(c.dist, c.param, true);
  3872. } // quantile complement
  3873. template <class RealType, class Policy>
  3874. BOOST_MATH_GPU_ENABLED inline RealType mean(const mapairy_distribution<RealType, Policy> &dist)
  3875. {
  3876. return dist.location();
  3877. }
  3878. template <class RealType, class Policy>
  3879. BOOST_MATH_GPU_ENABLED inline RealType variance(const mapairy_distribution<RealType, Policy>& /*dist*/)
  3880. {
  3881. return boost::math::numeric_limits<RealType>::infinity();
  3882. }
  3883. template <class RealType, class Policy>
  3884. BOOST_MATH_GPU_ENABLED inline RealType mode(const mapairy_distribution<RealType, Policy>& dist)
  3885. {
  3886. return detail::mapairy_mode_imp(dist);
  3887. }
  3888. template <class RealType, class Policy>
  3889. BOOST_MATH_GPU_ENABLED inline RealType median(const mapairy_distribution<RealType, Policy>& dist)
  3890. {
  3891. return detail::mapairy_median_imp(dist);
  3892. }
  3893. template <class RealType, class Policy>
  3894. BOOST_MATH_GPU_ENABLED inline RealType skewness(const mapairy_distribution<RealType, Policy>& /*dist*/)
  3895. {
  3896. // There is no skewness:
  3897. typedef typename Policy::assert_undefined_type assert_type;
  3898. static_assert(assert_type::value == 0, "The Map-Airy Distribution has no skewness");
  3899. return policies::raise_domain_error<RealType>(
  3900. "boost::math::skewness(mapairy<%1%>&)",
  3901. "The Map-Airy distribution does not have a skewness: "
  3902. "the only possible return value is %1%.",
  3903. boost::math::numeric_limits<RealType>::quiet_NaN(), Policy()); // infinity?
  3904. }
  3905. template <class RealType, class Policy>
  3906. BOOST_MATH_GPU_ENABLED inline RealType kurtosis(const mapairy_distribution<RealType, Policy>& /*dist*/)
  3907. {
  3908. // There is no kurtosis:
  3909. typedef typename Policy::assert_undefined_type assert_type;
  3910. static_assert(assert_type::value == 0, "The Map-Airy Distribution has no kurtosis");
  3911. return policies::raise_domain_error<RealType>(
  3912. "boost::math::kurtosis(mapairy<%1%>&)",
  3913. "The Map-Airy distribution does not have a kurtosis: "
  3914. "the only possible return value is %1%.",
  3915. boost::math::numeric_limits<RealType>::quiet_NaN(), Policy());
  3916. }
  3917. template <class RealType, class Policy>
  3918. BOOST_MATH_GPU_ENABLED inline RealType kurtosis_excess(const mapairy_distribution<RealType, Policy>& /*dist*/)
  3919. {
  3920. // There is no kurtosis excess:
  3921. typedef typename Policy::assert_undefined_type assert_type;
  3922. static_assert(assert_type::value == 0, "The Map-Airy Distribution has no kurtosis excess");
  3923. return policies::raise_domain_error<RealType>(
  3924. "boost::math::kurtosis_excess(mapairy<%1%>&)",
  3925. "The Map-Airy distribution does not have a kurtosis: "
  3926. "the only possible return value is %1%.",
  3927. boost::math::numeric_limits<RealType>::quiet_NaN(), Policy());
  3928. }
  3929. template <class RealType, class Policy>
  3930. BOOST_MATH_GPU_ENABLED inline RealType entropy(const mapairy_distribution<RealType, Policy>& dist)
  3931. {
  3932. return detail::mapairy_entropy_imp(dist);
  3933. }
  3934. }} // namespaces
  3935. #endif // BOOST_STATS_MAPAIRY_HPP