| 1 | // Copyright John Maddock 2006. |
| 2 | // Use, modification and distribution are subject to the |
| 3 | // Boost Software License, Version 1.0. (See accompanying file |
| 4 | // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 5 | |
| 6 | #ifndef BOOST_MATH_SP_UC_FACTORIALS_HPP |
| 7 | #define BOOST_MATH_SP_UC_FACTORIALS_HPP |
| 8 | |
| 9 | #ifdef _MSC_VER |
| 10 | #pragma once |
| 11 | #endif |
| 12 | |
| 13 | #ifdef _MSC_VER |
| 14 | #pragma warning(push) // Temporary until lexical cast fixed. |
| 15 | #pragma warning(disable: 4127 4701) |
| 16 | #endif |
| 17 | #include <boost/math/tools/convert_from_string.hpp> |
| 18 | #ifdef _MSC_VER |
| 19 | #pragma warning(pop) |
| 20 | #endif |
| 21 | #include <cmath> |
| 22 | #include <boost/math/special_functions/math_fwd.hpp> |
| 23 | #include <boost/math/tools/cxx03_warn.hpp> |
| 24 | #include <array> |
| 25 | #include <type_traits> |
| 26 | |
| 27 | #if defined(__GNUC__) && defined(BOOST_MATH_USE_FLOAT128) |
| 28 | // |
| 29 | // This is the only way we can avoid |
| 30 | // warning: non-standard suffix on floating constant [-Wpedantic] |
| 31 | // when building with -Wall -pedantic. Neither __extension__ |
| 32 | // nor #pragma diagnostic ignored work :( |
| 33 | // |
| 34 | #pragma GCC system_header |
| 35 | #endif |
| 36 | |
| 37 | namespace boost { namespace math |
| 38 | { |
| 39 | // Forward declarations: |
| 40 | template <class T> |
| 41 | struct max_factorial; |
| 42 | // |
| 43 | // see https://github.com/boostorg/math/issues/923 |
| 44 | // for the rationale behin using struct's for constexpr data: |
| 45 | // |
| 46 | template <class T, bool = true> |
| 47 | struct unchecked_factorial_data; |
| 48 | |
| 49 | template <bool b> |
| 50 | struct unchecked_factorial_data<float, b> |
| 51 | { |
| 52 | #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES |
| 53 | static constexpr std::array<float, 35> factorials = { ._M_elems: { |
| 54 | 1.0F, |
| 55 | 1.0F, |
| 56 | 2.0F, |
| 57 | 6.0F, |
| 58 | 24.0F, |
| 59 | 120.0F, |
| 60 | 720.0F, |
| 61 | 5040.0F, |
| 62 | 40320.0F, |
| 63 | 362880.0F, |
| 64 | 3628800.0F, |
| 65 | 39916800.0F, |
| 66 | 479001600.0F, |
| 67 | 6227020800.0F, |
| 68 | 87178291200.0F, |
| 69 | 1307674368000.0F, |
| 70 | 20922789888000.0F, |
| 71 | 355687428096000.0F, |
| 72 | 6402373705728000.0F, |
| 73 | 121645100408832000.0F, |
| 74 | 0.243290200817664e19F, |
| 75 | 0.5109094217170944e20F, |
| 76 | 0.112400072777760768e22F, |
| 77 | 0.2585201673888497664e23F, |
| 78 | 0.62044840173323943936e24F, |
| 79 | 0.15511210043330985984e26F, |
| 80 | 0.403291461126605635584e27F, |
| 81 | 0.10888869450418352160768e29F, |
| 82 | 0.304888344611713860501504e30F, |
| 83 | 0.8841761993739701954543616e31F, |
| 84 | 0.26525285981219105863630848e33F, |
| 85 | 0.822283865417792281772556288e34F, |
| 86 | 0.26313083693369353016721801216e36F, |
| 87 | 0.868331761881188649551819440128e37F, |
| 88 | 0.29523279903960414084761860964352e39F, |
| 89 | }}; |
| 90 | #else |
| 91 | static const std::array<float, 35> factorials; |
| 92 | #endif |
| 93 | }; |
| 94 | |
| 95 | template<bool b> |
| 96 | #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES |
| 97 | constexpr std::array<float, 35> unchecked_factorial_data<float, b>::factorials; |
| 98 | #else |
| 99 | const std::array<float, 35> unchecked_factorial_data<float, b>::factorials = {{ |
| 100 | 1.0F, |
| 101 | 1.0F, |
| 102 | 2.0F, |
| 103 | 6.0F, |
| 104 | 24.0F, |
| 105 | 120.0F, |
| 106 | 720.0F, |
| 107 | 5040.0F, |
| 108 | 40320.0F, |
| 109 | 362880.0F, |
| 110 | 3628800.0F, |
| 111 | 39916800.0F, |
| 112 | 479001600.0F, |
| 113 | 6227020800.0F, |
| 114 | 87178291200.0F, |
| 115 | 1307674368000.0F, |
| 116 | 20922789888000.0F, |
| 117 | 355687428096000.0F, |
| 118 | 6402373705728000.0F, |
| 119 | 121645100408832000.0F, |
| 120 | 0.243290200817664e19F, |
| 121 | 0.5109094217170944e20F, |
| 122 | 0.112400072777760768e22F, |
| 123 | 0.2585201673888497664e23F, |
| 124 | 0.62044840173323943936e24F, |
| 125 | 0.15511210043330985984e26F, |
| 126 | 0.403291461126605635584e27F, |
| 127 | 0.10888869450418352160768e29F, |
| 128 | 0.304888344611713860501504e30F, |
| 129 | 0.8841761993739701954543616e31F, |
| 130 | 0.26525285981219105863630848e33F, |
| 131 | 0.822283865417792281772556288e34F, |
| 132 | 0.26313083693369353016721801216e36F, |
| 133 | 0.868331761881188649551819440128e37F, |
| 134 | 0.29523279903960414084761860964352e39F, |
| 135 | }}; |
| 136 | #endif |
| 137 | |
| 138 | // Definitions: |
| 139 | template <> |
| 140 | inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION float unchecked_factorial<float>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(float)) |
| 141 | { |
| 142 | return unchecked_factorial_data<float>::factorials[i]; |
| 143 | } |
| 144 | |
| 145 | template <> |
| 146 | struct max_factorial<float> |
| 147 | { |
| 148 | static constexpr unsigned value = 34; |
| 149 | }; |
| 150 | |
| 151 | template <bool b> |
| 152 | struct unchecked_factorial_data<double, b> |
| 153 | { |
| 154 | #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES |
| 155 | static constexpr std::array<double, 171> factorials = { ._M_elems: { |
| 156 | 1.0, |
| 157 | 1.0, |
| 158 | 2.0, |
| 159 | 6.0, |
| 160 | 24.0, |
| 161 | 120.0, |
| 162 | 720.0, |
| 163 | 5040.0, |
| 164 | 40320.0, |
| 165 | 362880.0, |
| 166 | 3628800.0, |
| 167 | 39916800.0, |
| 168 | 479001600.0, |
| 169 | 6227020800.0, |
| 170 | 87178291200.0, |
| 171 | 1307674368000.0, |
| 172 | 20922789888000.0, |
| 173 | 355687428096000.0, |
| 174 | 6402373705728000.0, |
| 175 | 121645100408832000.0, |
| 176 | 0.243290200817664e19, |
| 177 | 0.5109094217170944e20, |
| 178 | 0.112400072777760768e22, |
| 179 | 0.2585201673888497664e23, |
| 180 | 0.62044840173323943936e24, |
| 181 | 0.15511210043330985984e26, |
| 182 | 0.403291461126605635584e27, |
| 183 | 0.10888869450418352160768e29, |
| 184 | 0.304888344611713860501504e30, |
| 185 | 0.8841761993739701954543616e31, |
| 186 | 0.26525285981219105863630848e33, |
| 187 | 0.822283865417792281772556288e34, |
| 188 | 0.26313083693369353016721801216e36, |
| 189 | 0.868331761881188649551819440128e37, |
| 190 | 0.29523279903960414084761860964352e39, |
| 191 | 0.103331479663861449296666513375232e41, |
| 192 | 0.3719933267899012174679994481508352e42, |
| 193 | 0.137637530912263450463159795815809024e44, |
| 194 | 0.5230226174666011117600072241000742912e45, |
| 195 | 0.203978820811974433586402817399028973568e47, |
| 196 | 0.815915283247897734345611269596115894272e48, |
| 197 | 0.3345252661316380710817006205344075166515e50, |
| 198 | 0.1405006117752879898543142606244511569936e52, |
| 199 | 0.6041526306337383563735513206851399750726e53, |
| 200 | 0.265827157478844876804362581101461589032e55, |
| 201 | 0.1196222208654801945619631614956577150644e57, |
| 202 | 0.5502622159812088949850305428800254892962e58, |
| 203 | 0.2586232415111681806429643551536119799692e60, |
| 204 | 0.1241391559253607267086228904737337503852e62, |
| 205 | 0.6082818640342675608722521633212953768876e63, |
| 206 | 0.3041409320171337804361260816606476884438e65, |
| 207 | 0.1551118753287382280224243016469303211063e67, |
| 208 | 0.8065817517094387857166063685640376697529e68, |
| 209 | 0.427488328406002556429801375338939964969e70, |
| 210 | 0.2308436973392413804720927426830275810833e72, |
| 211 | 0.1269640335365827592596510084756651695958e74, |
| 212 | 0.7109985878048634518540456474637249497365e75, |
| 213 | 0.4052691950487721675568060190543232213498e77, |
| 214 | 0.2350561331282878571829474910515074683829e79, |
| 215 | 0.1386831185456898357379390197203894063459e81, |
| 216 | 0.8320987112741390144276341183223364380754e82, |
| 217 | 0.507580213877224798800856812176625227226e84, |
| 218 | 0.3146997326038793752565312235495076408801e86, |
| 219 | 0.1982608315404440064116146708361898137545e88, |
| 220 | 0.1268869321858841641034333893351614808029e90, |
| 221 | 0.8247650592082470666723170306785496252186e91, |
| 222 | 0.5443449390774430640037292402478427526443e93, |
| 223 | 0.3647111091818868528824985909660546442717e95, |
| 224 | 0.2480035542436830599600990418569171581047e97, |
| 225 | 0.1711224524281413113724683388812728390923e99, |
| 226 | 0.1197857166996989179607278372168909873646e101, |
| 227 | 0.8504785885678623175211676442399260102886e102, |
| 228 | 0.6123445837688608686152407038527467274078e104, |
| 229 | 0.4470115461512684340891257138125051110077e106, |
| 230 | 0.3307885441519386412259530282212537821457e108, |
| 231 | 0.2480914081139539809194647711659403366093e110, |
| 232 | 0.188549470166605025498793226086114655823e112, |
| 233 | 0.1451830920282858696340707840863082849837e114, |
| 234 | 0.1132428117820629783145752115873204622873e116, |
| 235 | 0.8946182130782975286851441715398316520698e117, |
| 236 | 0.7156945704626380229481153372318653216558e119, |
| 237 | 0.5797126020747367985879734231578109105412e121, |
| 238 | 0.4753643337012841748421382069894049466438e123, |
| 239 | 0.3945523969720658651189747118012061057144e125, |
| 240 | 0.3314240134565353266999387579130131288001e127, |
| 241 | 0.2817104114380550276949479442260611594801e129, |
| 242 | 0.2422709538367273238176552320344125971528e131, |
| 243 | 0.210775729837952771721360051869938959523e133, |
| 244 | 0.1854826422573984391147968456455462843802e135, |
| 245 | 0.1650795516090846108121691926245361930984e137, |
| 246 | 0.1485715964481761497309522733620825737886e139, |
| 247 | 0.1352001527678402962551665687594951421476e141, |
| 248 | 0.1243841405464130725547532432587355307758e143, |
| 249 | 0.1156772507081641574759205162306240436215e145, |
| 250 | 0.1087366156656743080273652852567866010042e147, |
| 251 | 0.103299784882390592625997020993947270954e149, |
| 252 | 0.9916779348709496892095714015418938011582e150, |
| 253 | 0.9619275968248211985332842594956369871234e152, |
| 254 | 0.942689044888324774562618574305724247381e154, |
| 255 | 0.9332621544394415268169923885626670049072e156, |
| 256 | 0.9332621544394415268169923885626670049072e158, |
| 257 | 0.9425947759838359420851623124482936749562e160, |
| 258 | 0.9614466715035126609268655586972595484554e162, |
| 259 | 0.990290071648618040754671525458177334909e164, |
| 260 | 0.1029901674514562762384858386476504428305e167, |
| 261 | 0.1081396758240290900504101305800329649721e169, |
| 262 | 0.1146280563734708354534347384148349428704e171, |
| 263 | 0.1226520203196137939351751701038733888713e173, |
| 264 | 0.132464181945182897449989183712183259981e175, |
| 265 | 0.1443859583202493582204882102462797533793e177, |
| 266 | 0.1588245541522742940425370312709077287172e179, |
| 267 | 0.1762952551090244663872161047107075788761e181, |
| 268 | 0.1974506857221074023536820372759924883413e183, |
| 269 | 0.2231192748659813646596607021218715118256e185, |
| 270 | 0.2543559733472187557120132004189335234812e187, |
| 271 | 0.2925093693493015690688151804817735520034e189, |
| 272 | 0.339310868445189820119825609358857320324e191, |
| 273 | 0.396993716080872089540195962949863064779e193, |
| 274 | 0.4684525849754290656574312362808384164393e195, |
| 275 | 0.5574585761207605881323431711741977155627e197, |
| 276 | 0.6689502913449127057588118054090372586753e199, |
| 277 | 0.8094298525273443739681622845449350829971e201, |
| 278 | 0.9875044200833601362411579871448208012564e203, |
| 279 | 0.1214630436702532967576624324188129585545e206, |
| 280 | 0.1506141741511140879795014161993280686076e208, |
| 281 | 0.1882677176888926099743767702491600857595e210, |
| 282 | 0.237217324288004688567714730513941708057e212, |
| 283 | 0.3012660018457659544809977077527059692324e214, |
| 284 | 0.3856204823625804217356770659234636406175e216, |
| 285 | 0.4974504222477287440390234150412680963966e218, |
| 286 | 0.6466855489220473672507304395536485253155e220, |
| 287 | 0.8471580690878820510984568758152795681634e222, |
| 288 | 0.1118248651196004307449963076076169029976e225, |
| 289 | 0.1487270706090685728908450891181304809868e227, |
| 290 | 0.1992942746161518876737324194182948445223e229, |
| 291 | 0.269047270731805048359538766214698040105e231, |
| 292 | 0.3659042881952548657689727220519893345429e233, |
| 293 | 0.5012888748274991661034926292112253883237e235, |
| 294 | 0.6917786472619488492228198283114910358867e237, |
| 295 | 0.9615723196941089004197195613529725398826e239, |
| 296 | 0.1346201247571752460587607385894161555836e242, |
| 297 | 0.1898143759076170969428526414110767793728e244, |
| 298 | 0.2695364137888162776588507508037290267094e246, |
| 299 | 0.3854370717180072770521565736493325081944e248, |
| 300 | 0.5550293832739304789551054660550388118e250, |
| 301 | 0.80479260574719919448490292577980627711e252, |
| 302 | 0.1174997204390910823947958271638517164581e255, |
| 303 | 0.1727245890454638911203498659308620231933e257, |
| 304 | 0.2556323917872865588581178015776757943262e259, |
| 305 | 0.380892263763056972698595524350736933546e261, |
| 306 | 0.571338395644585459047893286526105400319e263, |
| 307 | 0.8627209774233240431623188626544191544816e265, |
| 308 | 0.1311335885683452545606724671234717114812e268, |
| 309 | 0.2006343905095682394778288746989117185662e270, |
| 310 | 0.308976961384735088795856467036324046592e272, |
| 311 | 0.4789142901463393876335775239063022722176e274, |
| 312 | 0.7471062926282894447083809372938315446595e276, |
| 313 | 0.1172956879426414428192158071551315525115e279, |
| 314 | 0.1853271869493734796543609753051078529682e281, |
| 315 | 0.2946702272495038326504339507351214862195e283, |
| 316 | 0.4714723635992061322406943211761943779512e285, |
| 317 | 0.7590705053947218729075178570936729485014e287, |
| 318 | 0.1229694218739449434110178928491750176572e290, |
| 319 | 0.2004401576545302577599591653441552787813e292, |
| 320 | 0.3287218585534296227263330311644146572013e294, |
| 321 | 0.5423910666131588774984495014212841843822e296, |
| 322 | 0.9003691705778437366474261723593317460744e298, |
| 323 | 0.1503616514864999040201201707840084015944e301, |
| 324 | 0.2526075744973198387538018869171341146786e303, |
| 325 | 0.4269068009004705274939251888899566538069e305, |
| 326 | 0.7257415615307998967396728211129263114717e307, |
| 327 | }}; |
| 328 | #else |
| 329 | static const std::array<double, 171> factorials; |
| 330 | #endif |
| 331 | }; |
| 332 | |
| 333 | template <bool b> |
| 334 | #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES |
| 335 | constexpr std::array<double, 171> unchecked_factorial_data<double, b>::factorials; |
| 336 | #else |
| 337 | const std::array<double, 171> unchecked_factorial_data<double, b>::factorials = {{ |
| 338 | 1.0, |
| 339 | 1.0, |
| 340 | 2.0, |
| 341 | 6.0, |
| 342 | 24.0, |
| 343 | 120.0, |
| 344 | 720.0, |
| 345 | 5040.0, |
| 346 | 40320.0, |
| 347 | 362880.0, |
| 348 | 3628800.0, |
| 349 | 39916800.0, |
| 350 | 479001600.0, |
| 351 | 6227020800.0, |
| 352 | 87178291200.0, |
| 353 | 1307674368000.0, |
| 354 | 20922789888000.0, |
| 355 | 355687428096000.0, |
| 356 | 6402373705728000.0, |
| 357 | 121645100408832000.0, |
| 358 | 0.243290200817664e19, |
| 359 | 0.5109094217170944e20, |
| 360 | 0.112400072777760768e22, |
| 361 | 0.2585201673888497664e23, |
| 362 | 0.62044840173323943936e24, |
| 363 | 0.15511210043330985984e26, |
| 364 | 0.403291461126605635584e27, |
| 365 | 0.10888869450418352160768e29, |
| 366 | 0.304888344611713860501504e30, |
| 367 | 0.8841761993739701954543616e31, |
| 368 | 0.26525285981219105863630848e33, |
| 369 | 0.822283865417792281772556288e34, |
| 370 | 0.26313083693369353016721801216e36, |
| 371 | 0.868331761881188649551819440128e37, |
| 372 | 0.29523279903960414084761860964352e39, |
| 373 | 0.103331479663861449296666513375232e41, |
| 374 | 0.3719933267899012174679994481508352e42, |
| 375 | 0.137637530912263450463159795815809024e44, |
| 376 | 0.5230226174666011117600072241000742912e45, |
| 377 | 0.203978820811974433586402817399028973568e47, |
| 378 | 0.815915283247897734345611269596115894272e48, |
| 379 | 0.3345252661316380710817006205344075166515e50, |
| 380 | 0.1405006117752879898543142606244511569936e52, |
| 381 | 0.6041526306337383563735513206851399750726e53, |
| 382 | 0.265827157478844876804362581101461589032e55, |
| 383 | 0.1196222208654801945619631614956577150644e57, |
| 384 | 0.5502622159812088949850305428800254892962e58, |
| 385 | 0.2586232415111681806429643551536119799692e60, |
| 386 | 0.1241391559253607267086228904737337503852e62, |
| 387 | 0.6082818640342675608722521633212953768876e63, |
| 388 | 0.3041409320171337804361260816606476884438e65, |
| 389 | 0.1551118753287382280224243016469303211063e67, |
| 390 | 0.8065817517094387857166063685640376697529e68, |
| 391 | 0.427488328406002556429801375338939964969e70, |
| 392 | 0.2308436973392413804720927426830275810833e72, |
| 393 | 0.1269640335365827592596510084756651695958e74, |
| 394 | 0.7109985878048634518540456474637249497365e75, |
| 395 | 0.4052691950487721675568060190543232213498e77, |
| 396 | 0.2350561331282878571829474910515074683829e79, |
| 397 | 0.1386831185456898357379390197203894063459e81, |
| 398 | 0.8320987112741390144276341183223364380754e82, |
| 399 | 0.507580213877224798800856812176625227226e84, |
| 400 | 0.3146997326038793752565312235495076408801e86, |
| 401 | 0.1982608315404440064116146708361898137545e88, |
| 402 | 0.1268869321858841641034333893351614808029e90, |
| 403 | 0.8247650592082470666723170306785496252186e91, |
| 404 | 0.5443449390774430640037292402478427526443e93, |
| 405 | 0.3647111091818868528824985909660546442717e95, |
| 406 | 0.2480035542436830599600990418569171581047e97, |
| 407 | 0.1711224524281413113724683388812728390923e99, |
| 408 | 0.1197857166996989179607278372168909873646e101, |
| 409 | 0.8504785885678623175211676442399260102886e102, |
| 410 | 0.6123445837688608686152407038527467274078e104, |
| 411 | 0.4470115461512684340891257138125051110077e106, |
| 412 | 0.3307885441519386412259530282212537821457e108, |
| 413 | 0.2480914081139539809194647711659403366093e110, |
| 414 | 0.188549470166605025498793226086114655823e112, |
| 415 | 0.1451830920282858696340707840863082849837e114, |
| 416 | 0.1132428117820629783145752115873204622873e116, |
| 417 | 0.8946182130782975286851441715398316520698e117, |
| 418 | 0.7156945704626380229481153372318653216558e119, |
| 419 | 0.5797126020747367985879734231578109105412e121, |
| 420 | 0.4753643337012841748421382069894049466438e123, |
| 421 | 0.3945523969720658651189747118012061057144e125, |
| 422 | 0.3314240134565353266999387579130131288001e127, |
| 423 | 0.2817104114380550276949479442260611594801e129, |
| 424 | 0.2422709538367273238176552320344125971528e131, |
| 425 | 0.210775729837952771721360051869938959523e133, |
| 426 | 0.1854826422573984391147968456455462843802e135, |
| 427 | 0.1650795516090846108121691926245361930984e137, |
| 428 | 0.1485715964481761497309522733620825737886e139, |
| 429 | 0.1352001527678402962551665687594951421476e141, |
| 430 | 0.1243841405464130725547532432587355307758e143, |
| 431 | 0.1156772507081641574759205162306240436215e145, |
| 432 | 0.1087366156656743080273652852567866010042e147, |
| 433 | 0.103299784882390592625997020993947270954e149, |
| 434 | 0.9916779348709496892095714015418938011582e150, |
| 435 | 0.9619275968248211985332842594956369871234e152, |
| 436 | 0.942689044888324774562618574305724247381e154, |
| 437 | 0.9332621544394415268169923885626670049072e156, |
| 438 | 0.9332621544394415268169923885626670049072e158, |
| 439 | 0.9425947759838359420851623124482936749562e160, |
| 440 | 0.9614466715035126609268655586972595484554e162, |
| 441 | 0.990290071648618040754671525458177334909e164, |
| 442 | 0.1029901674514562762384858386476504428305e167, |
| 443 | 0.1081396758240290900504101305800329649721e169, |
| 444 | 0.1146280563734708354534347384148349428704e171, |
| 445 | 0.1226520203196137939351751701038733888713e173, |
| 446 | 0.132464181945182897449989183712183259981e175, |
| 447 | 0.1443859583202493582204882102462797533793e177, |
| 448 | 0.1588245541522742940425370312709077287172e179, |
| 449 | 0.1762952551090244663872161047107075788761e181, |
| 450 | 0.1974506857221074023536820372759924883413e183, |
| 451 | 0.2231192748659813646596607021218715118256e185, |
| 452 | 0.2543559733472187557120132004189335234812e187, |
| 453 | 0.2925093693493015690688151804817735520034e189, |
| 454 | 0.339310868445189820119825609358857320324e191, |
| 455 | 0.396993716080872089540195962949863064779e193, |
| 456 | 0.4684525849754290656574312362808384164393e195, |
| 457 | 0.5574585761207605881323431711741977155627e197, |
| 458 | 0.6689502913449127057588118054090372586753e199, |
| 459 | 0.8094298525273443739681622845449350829971e201, |
| 460 | 0.9875044200833601362411579871448208012564e203, |
| 461 | 0.1214630436702532967576624324188129585545e206, |
| 462 | 0.1506141741511140879795014161993280686076e208, |
| 463 | 0.1882677176888926099743767702491600857595e210, |
| 464 | 0.237217324288004688567714730513941708057e212, |
| 465 | 0.3012660018457659544809977077527059692324e214, |
| 466 | 0.3856204823625804217356770659234636406175e216, |
| 467 | 0.4974504222477287440390234150412680963966e218, |
| 468 | 0.6466855489220473672507304395536485253155e220, |
| 469 | 0.8471580690878820510984568758152795681634e222, |
| 470 | 0.1118248651196004307449963076076169029976e225, |
| 471 | 0.1487270706090685728908450891181304809868e227, |
| 472 | 0.1992942746161518876737324194182948445223e229, |
| 473 | 0.269047270731805048359538766214698040105e231, |
| 474 | 0.3659042881952548657689727220519893345429e233, |
| 475 | 0.5012888748274991661034926292112253883237e235, |
| 476 | 0.6917786472619488492228198283114910358867e237, |
| 477 | 0.9615723196941089004197195613529725398826e239, |
| 478 | 0.1346201247571752460587607385894161555836e242, |
| 479 | 0.1898143759076170969428526414110767793728e244, |
| 480 | 0.2695364137888162776588507508037290267094e246, |
| 481 | 0.3854370717180072770521565736493325081944e248, |
| 482 | 0.5550293832739304789551054660550388118e250, |
| 483 | 0.80479260574719919448490292577980627711e252, |
| 484 | 0.1174997204390910823947958271638517164581e255, |
| 485 | 0.1727245890454638911203498659308620231933e257, |
| 486 | 0.2556323917872865588581178015776757943262e259, |
| 487 | 0.380892263763056972698595524350736933546e261, |
| 488 | 0.571338395644585459047893286526105400319e263, |
| 489 | 0.8627209774233240431623188626544191544816e265, |
| 490 | 0.1311335885683452545606724671234717114812e268, |
| 491 | 0.2006343905095682394778288746989117185662e270, |
| 492 | 0.308976961384735088795856467036324046592e272, |
| 493 | 0.4789142901463393876335775239063022722176e274, |
| 494 | 0.7471062926282894447083809372938315446595e276, |
| 495 | 0.1172956879426414428192158071551315525115e279, |
| 496 | 0.1853271869493734796543609753051078529682e281, |
| 497 | 0.2946702272495038326504339507351214862195e283, |
| 498 | 0.4714723635992061322406943211761943779512e285, |
| 499 | 0.7590705053947218729075178570936729485014e287, |
| 500 | 0.1229694218739449434110178928491750176572e290, |
| 501 | 0.2004401576545302577599591653441552787813e292, |
| 502 | 0.3287218585534296227263330311644146572013e294, |
| 503 | 0.5423910666131588774984495014212841843822e296, |
| 504 | 0.9003691705778437366474261723593317460744e298, |
| 505 | 0.1503616514864999040201201707840084015944e301, |
| 506 | 0.2526075744973198387538018869171341146786e303, |
| 507 | 0.4269068009004705274939251888899566538069e305, |
| 508 | 0.7257415615307998967396728211129263114717e307, |
| 509 | }}; |
| 510 | #endif |
| 511 | |
| 512 | template <> |
| 513 | inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION double unchecked_factorial<double>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(double)) |
| 514 | { |
| 515 | return unchecked_factorial_data<double>::factorials[i]; |
| 516 | } |
| 517 | |
| 518 | template <> |
| 519 | struct max_factorial<double> |
| 520 | { |
| 521 | static constexpr unsigned value = 170; |
| 522 | }; |
| 523 | |
| 524 | template <bool b> |
| 525 | struct unchecked_factorial_data<long double, b> |
| 526 | { |
| 527 | #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES |
| 528 | static constexpr std::array<long double, 171> factorials = { ._M_elems: { |
| 529 | 1L, |
| 530 | 1L, |
| 531 | 2L, |
| 532 | 6L, |
| 533 | 24L, |
| 534 | 120L, |
| 535 | 720L, |
| 536 | 5040L, |
| 537 | 40320L, |
| 538 | 362880.0L, |
| 539 | 3628800.0L, |
| 540 | 39916800.0L, |
| 541 | 479001600.0L, |
| 542 | 6227020800.0L, |
| 543 | 87178291200.0L, |
| 544 | 1307674368000.0L, |
| 545 | 20922789888000.0L, |
| 546 | 355687428096000.0L, |
| 547 | 6402373705728000.0L, |
| 548 | 121645100408832000.0L, |
| 549 | 0.243290200817664e19L, |
| 550 | 0.5109094217170944e20L, |
| 551 | 0.112400072777760768e22L, |
| 552 | 0.2585201673888497664e23L, |
| 553 | 0.62044840173323943936e24L, |
| 554 | 0.15511210043330985984e26L, |
| 555 | 0.403291461126605635584e27L, |
| 556 | 0.10888869450418352160768e29L, |
| 557 | 0.304888344611713860501504e30L, |
| 558 | 0.8841761993739701954543616e31L, |
| 559 | 0.26525285981219105863630848e33L, |
| 560 | 0.822283865417792281772556288e34L, |
| 561 | 0.26313083693369353016721801216e36L, |
| 562 | 0.868331761881188649551819440128e37L, |
| 563 | 0.29523279903960414084761860964352e39L, |
| 564 | 0.103331479663861449296666513375232e41L, |
| 565 | 0.3719933267899012174679994481508352e42L, |
| 566 | 0.137637530912263450463159795815809024e44L, |
| 567 | 0.5230226174666011117600072241000742912e45L, |
| 568 | 0.203978820811974433586402817399028973568e47L, |
| 569 | 0.815915283247897734345611269596115894272e48L, |
| 570 | 0.3345252661316380710817006205344075166515e50L, |
| 571 | 0.1405006117752879898543142606244511569936e52L, |
| 572 | 0.6041526306337383563735513206851399750726e53L, |
| 573 | 0.265827157478844876804362581101461589032e55L, |
| 574 | 0.1196222208654801945619631614956577150644e57L, |
| 575 | 0.5502622159812088949850305428800254892962e58L, |
| 576 | 0.2586232415111681806429643551536119799692e60L, |
| 577 | 0.1241391559253607267086228904737337503852e62L, |
| 578 | 0.6082818640342675608722521633212953768876e63L, |
| 579 | 0.3041409320171337804361260816606476884438e65L, |
| 580 | 0.1551118753287382280224243016469303211063e67L, |
| 581 | 0.8065817517094387857166063685640376697529e68L, |
| 582 | 0.427488328406002556429801375338939964969e70L, |
| 583 | 0.2308436973392413804720927426830275810833e72L, |
| 584 | 0.1269640335365827592596510084756651695958e74L, |
| 585 | 0.7109985878048634518540456474637249497365e75L, |
| 586 | 0.4052691950487721675568060190543232213498e77L, |
| 587 | 0.2350561331282878571829474910515074683829e79L, |
| 588 | 0.1386831185456898357379390197203894063459e81L, |
| 589 | 0.8320987112741390144276341183223364380754e82L, |
| 590 | 0.507580213877224798800856812176625227226e84L, |
| 591 | 0.3146997326038793752565312235495076408801e86L, |
| 592 | 0.1982608315404440064116146708361898137545e88L, |
| 593 | 0.1268869321858841641034333893351614808029e90L, |
| 594 | 0.8247650592082470666723170306785496252186e91L, |
| 595 | 0.5443449390774430640037292402478427526443e93L, |
| 596 | 0.3647111091818868528824985909660546442717e95L, |
| 597 | 0.2480035542436830599600990418569171581047e97L, |
| 598 | 0.1711224524281413113724683388812728390923e99L, |
| 599 | 0.1197857166996989179607278372168909873646e101L, |
| 600 | 0.8504785885678623175211676442399260102886e102L, |
| 601 | 0.6123445837688608686152407038527467274078e104L, |
| 602 | 0.4470115461512684340891257138125051110077e106L, |
| 603 | 0.3307885441519386412259530282212537821457e108L, |
| 604 | 0.2480914081139539809194647711659403366093e110L, |
| 605 | 0.188549470166605025498793226086114655823e112L, |
| 606 | 0.1451830920282858696340707840863082849837e114L, |
| 607 | 0.1132428117820629783145752115873204622873e116L, |
| 608 | 0.8946182130782975286851441715398316520698e117L, |
| 609 | 0.7156945704626380229481153372318653216558e119L, |
| 610 | 0.5797126020747367985879734231578109105412e121L, |
| 611 | 0.4753643337012841748421382069894049466438e123L, |
| 612 | 0.3945523969720658651189747118012061057144e125L, |
| 613 | 0.3314240134565353266999387579130131288001e127L, |
| 614 | 0.2817104114380550276949479442260611594801e129L, |
| 615 | 0.2422709538367273238176552320344125971528e131L, |
| 616 | 0.210775729837952771721360051869938959523e133L, |
| 617 | 0.1854826422573984391147968456455462843802e135L, |
| 618 | 0.1650795516090846108121691926245361930984e137L, |
| 619 | 0.1485715964481761497309522733620825737886e139L, |
| 620 | 0.1352001527678402962551665687594951421476e141L, |
| 621 | 0.1243841405464130725547532432587355307758e143L, |
| 622 | 0.1156772507081641574759205162306240436215e145L, |
| 623 | 0.1087366156656743080273652852567866010042e147L, |
| 624 | 0.103299784882390592625997020993947270954e149L, |
| 625 | 0.9916779348709496892095714015418938011582e150L, |
| 626 | 0.9619275968248211985332842594956369871234e152L, |
| 627 | 0.942689044888324774562618574305724247381e154L, |
| 628 | 0.9332621544394415268169923885626670049072e156L, |
| 629 | 0.9332621544394415268169923885626670049072e158L, |
| 630 | 0.9425947759838359420851623124482936749562e160L, |
| 631 | 0.9614466715035126609268655586972595484554e162L, |
| 632 | 0.990290071648618040754671525458177334909e164L, |
| 633 | 0.1029901674514562762384858386476504428305e167L, |
| 634 | 0.1081396758240290900504101305800329649721e169L, |
| 635 | 0.1146280563734708354534347384148349428704e171L, |
| 636 | 0.1226520203196137939351751701038733888713e173L, |
| 637 | 0.132464181945182897449989183712183259981e175L, |
| 638 | 0.1443859583202493582204882102462797533793e177L, |
| 639 | 0.1588245541522742940425370312709077287172e179L, |
| 640 | 0.1762952551090244663872161047107075788761e181L, |
| 641 | 0.1974506857221074023536820372759924883413e183L, |
| 642 | 0.2231192748659813646596607021218715118256e185L, |
| 643 | 0.2543559733472187557120132004189335234812e187L, |
| 644 | 0.2925093693493015690688151804817735520034e189L, |
| 645 | 0.339310868445189820119825609358857320324e191L, |
| 646 | 0.396993716080872089540195962949863064779e193L, |
| 647 | 0.4684525849754290656574312362808384164393e195L, |
| 648 | 0.5574585761207605881323431711741977155627e197L, |
| 649 | 0.6689502913449127057588118054090372586753e199L, |
| 650 | 0.8094298525273443739681622845449350829971e201L, |
| 651 | 0.9875044200833601362411579871448208012564e203L, |
| 652 | 0.1214630436702532967576624324188129585545e206L, |
| 653 | 0.1506141741511140879795014161993280686076e208L, |
| 654 | 0.1882677176888926099743767702491600857595e210L, |
| 655 | 0.237217324288004688567714730513941708057e212L, |
| 656 | 0.3012660018457659544809977077527059692324e214L, |
| 657 | 0.3856204823625804217356770659234636406175e216L, |
| 658 | 0.4974504222477287440390234150412680963966e218L, |
| 659 | 0.6466855489220473672507304395536485253155e220L, |
| 660 | 0.8471580690878820510984568758152795681634e222L, |
| 661 | 0.1118248651196004307449963076076169029976e225L, |
| 662 | 0.1487270706090685728908450891181304809868e227L, |
| 663 | 0.1992942746161518876737324194182948445223e229L, |
| 664 | 0.269047270731805048359538766214698040105e231L, |
| 665 | 0.3659042881952548657689727220519893345429e233L, |
| 666 | 0.5012888748274991661034926292112253883237e235L, |
| 667 | 0.6917786472619488492228198283114910358867e237L, |
| 668 | 0.9615723196941089004197195613529725398826e239L, |
| 669 | 0.1346201247571752460587607385894161555836e242L, |
| 670 | 0.1898143759076170969428526414110767793728e244L, |
| 671 | 0.2695364137888162776588507508037290267094e246L, |
| 672 | 0.3854370717180072770521565736493325081944e248L, |
| 673 | 0.5550293832739304789551054660550388118e250L, |
| 674 | 0.80479260574719919448490292577980627711e252L, |
| 675 | 0.1174997204390910823947958271638517164581e255L, |
| 676 | 0.1727245890454638911203498659308620231933e257L, |
| 677 | 0.2556323917872865588581178015776757943262e259L, |
| 678 | 0.380892263763056972698595524350736933546e261L, |
| 679 | 0.571338395644585459047893286526105400319e263L, |
| 680 | 0.8627209774233240431623188626544191544816e265L, |
| 681 | 0.1311335885683452545606724671234717114812e268L, |
| 682 | 0.2006343905095682394778288746989117185662e270L, |
| 683 | 0.308976961384735088795856467036324046592e272L, |
| 684 | 0.4789142901463393876335775239063022722176e274L, |
| 685 | 0.7471062926282894447083809372938315446595e276L, |
| 686 | 0.1172956879426414428192158071551315525115e279L, |
| 687 | 0.1853271869493734796543609753051078529682e281L, |
| 688 | 0.2946702272495038326504339507351214862195e283L, |
| 689 | 0.4714723635992061322406943211761943779512e285L, |
| 690 | 0.7590705053947218729075178570936729485014e287L, |
| 691 | 0.1229694218739449434110178928491750176572e290L, |
| 692 | 0.2004401576545302577599591653441552787813e292L, |
| 693 | 0.3287218585534296227263330311644146572013e294L, |
| 694 | 0.5423910666131588774984495014212841843822e296L, |
| 695 | 0.9003691705778437366474261723593317460744e298L, |
| 696 | 0.1503616514864999040201201707840084015944e301L, |
| 697 | 0.2526075744973198387538018869171341146786e303L, |
| 698 | 0.4269068009004705274939251888899566538069e305L, |
| 699 | 0.7257415615307998967396728211129263114717e307L, |
| 700 | }}; |
| 701 | #else |
| 702 | static const std::array<long double, 171> factorials; |
| 703 | #endif |
| 704 | }; |
| 705 | |
| 706 | template <bool b> |
| 707 | #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES |
| 708 | constexpr std::array<long double, 171> unchecked_factorial_data<long double, b>::factorials; |
| 709 | #else |
| 710 | const std::array<long double, 171> unchecked_factorial_data<long double, b>::factorials = {{ |
| 711 | 1L, |
| 712 | 1L, |
| 713 | 2L, |
| 714 | 6L, |
| 715 | 24L, |
| 716 | 120L, |
| 717 | 720L, |
| 718 | 5040L, |
| 719 | 40320L, |
| 720 | 362880.0L, |
| 721 | 3628800.0L, |
| 722 | 39916800.0L, |
| 723 | 479001600.0L, |
| 724 | 6227020800.0L, |
| 725 | 87178291200.0L, |
| 726 | 1307674368000.0L, |
| 727 | 20922789888000.0L, |
| 728 | 355687428096000.0L, |
| 729 | 6402373705728000.0L, |
| 730 | 121645100408832000.0L, |
| 731 | 0.243290200817664e19L, |
| 732 | 0.5109094217170944e20L, |
| 733 | 0.112400072777760768e22L, |
| 734 | 0.2585201673888497664e23L, |
| 735 | 0.62044840173323943936e24L, |
| 736 | 0.15511210043330985984e26L, |
| 737 | 0.403291461126605635584e27L, |
| 738 | 0.10888869450418352160768e29L, |
| 739 | 0.304888344611713860501504e30L, |
| 740 | 0.8841761993739701954543616e31L, |
| 741 | 0.26525285981219105863630848e33L, |
| 742 | 0.822283865417792281772556288e34L, |
| 743 | 0.26313083693369353016721801216e36L, |
| 744 | 0.868331761881188649551819440128e37L, |
| 745 | 0.29523279903960414084761860964352e39L, |
| 746 | 0.103331479663861449296666513375232e41L, |
| 747 | 0.3719933267899012174679994481508352e42L, |
| 748 | 0.137637530912263450463159795815809024e44L, |
| 749 | 0.5230226174666011117600072241000742912e45L, |
| 750 | 0.203978820811974433586402817399028973568e47L, |
| 751 | 0.815915283247897734345611269596115894272e48L, |
| 752 | 0.3345252661316380710817006205344075166515e50L, |
| 753 | 0.1405006117752879898543142606244511569936e52L, |
| 754 | 0.6041526306337383563735513206851399750726e53L, |
| 755 | 0.265827157478844876804362581101461589032e55L, |
| 756 | 0.1196222208654801945619631614956577150644e57L, |
| 757 | 0.5502622159812088949850305428800254892962e58L, |
| 758 | 0.2586232415111681806429643551536119799692e60L, |
| 759 | 0.1241391559253607267086228904737337503852e62L, |
| 760 | 0.6082818640342675608722521633212953768876e63L, |
| 761 | 0.3041409320171337804361260816606476884438e65L, |
| 762 | 0.1551118753287382280224243016469303211063e67L, |
| 763 | 0.8065817517094387857166063685640376697529e68L, |
| 764 | 0.427488328406002556429801375338939964969e70L, |
| 765 | 0.2308436973392413804720927426830275810833e72L, |
| 766 | 0.1269640335365827592596510084756651695958e74L, |
| 767 | 0.7109985878048634518540456474637249497365e75L, |
| 768 | 0.4052691950487721675568060190543232213498e77L, |
| 769 | 0.2350561331282878571829474910515074683829e79L, |
| 770 | 0.1386831185456898357379390197203894063459e81L, |
| 771 | 0.8320987112741390144276341183223364380754e82L, |
| 772 | 0.507580213877224798800856812176625227226e84L, |
| 773 | 0.3146997326038793752565312235495076408801e86L, |
| 774 | 0.1982608315404440064116146708361898137545e88L, |
| 775 | 0.1268869321858841641034333893351614808029e90L, |
| 776 | 0.8247650592082470666723170306785496252186e91L, |
| 777 | 0.5443449390774430640037292402478427526443e93L, |
| 778 | 0.3647111091818868528824985909660546442717e95L, |
| 779 | 0.2480035542436830599600990418569171581047e97L, |
| 780 | 0.1711224524281413113724683388812728390923e99L, |
| 781 | 0.1197857166996989179607278372168909873646e101L, |
| 782 | 0.8504785885678623175211676442399260102886e102L, |
| 783 | 0.6123445837688608686152407038527467274078e104L, |
| 784 | 0.4470115461512684340891257138125051110077e106L, |
| 785 | 0.3307885441519386412259530282212537821457e108L, |
| 786 | 0.2480914081139539809194647711659403366093e110L, |
| 787 | 0.188549470166605025498793226086114655823e112L, |
| 788 | 0.1451830920282858696340707840863082849837e114L, |
| 789 | 0.1132428117820629783145752115873204622873e116L, |
| 790 | 0.8946182130782975286851441715398316520698e117L, |
| 791 | 0.7156945704626380229481153372318653216558e119L, |
| 792 | 0.5797126020747367985879734231578109105412e121L, |
| 793 | 0.4753643337012841748421382069894049466438e123L, |
| 794 | 0.3945523969720658651189747118012061057144e125L, |
| 795 | 0.3314240134565353266999387579130131288001e127L, |
| 796 | 0.2817104114380550276949479442260611594801e129L, |
| 797 | 0.2422709538367273238176552320344125971528e131L, |
| 798 | 0.210775729837952771721360051869938959523e133L, |
| 799 | 0.1854826422573984391147968456455462843802e135L, |
| 800 | 0.1650795516090846108121691926245361930984e137L, |
| 801 | 0.1485715964481761497309522733620825737886e139L, |
| 802 | 0.1352001527678402962551665687594951421476e141L, |
| 803 | 0.1243841405464130725547532432587355307758e143L, |
| 804 | 0.1156772507081641574759205162306240436215e145L, |
| 805 | 0.1087366156656743080273652852567866010042e147L, |
| 806 | 0.103299784882390592625997020993947270954e149L, |
| 807 | 0.9916779348709496892095714015418938011582e150L, |
| 808 | 0.9619275968248211985332842594956369871234e152L, |
| 809 | 0.942689044888324774562618574305724247381e154L, |
| 810 | 0.9332621544394415268169923885626670049072e156L, |
| 811 | 0.9332621544394415268169923885626670049072e158L, |
| 812 | 0.9425947759838359420851623124482936749562e160L, |
| 813 | 0.9614466715035126609268655586972595484554e162L, |
| 814 | 0.990290071648618040754671525458177334909e164L, |
| 815 | 0.1029901674514562762384858386476504428305e167L, |
| 816 | 0.1081396758240290900504101305800329649721e169L, |
| 817 | 0.1146280563734708354534347384148349428704e171L, |
| 818 | 0.1226520203196137939351751701038733888713e173L, |
| 819 | 0.132464181945182897449989183712183259981e175L, |
| 820 | 0.1443859583202493582204882102462797533793e177L, |
| 821 | 0.1588245541522742940425370312709077287172e179L, |
| 822 | 0.1762952551090244663872161047107075788761e181L, |
| 823 | 0.1974506857221074023536820372759924883413e183L, |
| 824 | 0.2231192748659813646596607021218715118256e185L, |
| 825 | 0.2543559733472187557120132004189335234812e187L, |
| 826 | 0.2925093693493015690688151804817735520034e189L, |
| 827 | 0.339310868445189820119825609358857320324e191L, |
| 828 | 0.396993716080872089540195962949863064779e193L, |
| 829 | 0.4684525849754290656574312362808384164393e195L, |
| 830 | 0.5574585761207605881323431711741977155627e197L, |
| 831 | 0.6689502913449127057588118054090372586753e199L, |
| 832 | 0.8094298525273443739681622845449350829971e201L, |
| 833 | 0.9875044200833601362411579871448208012564e203L, |
| 834 | 0.1214630436702532967576624324188129585545e206L, |
| 835 | 0.1506141741511140879795014161993280686076e208L, |
| 836 | 0.1882677176888926099743767702491600857595e210L, |
| 837 | 0.237217324288004688567714730513941708057e212L, |
| 838 | 0.3012660018457659544809977077527059692324e214L, |
| 839 | 0.3856204823625804217356770659234636406175e216L, |
| 840 | 0.4974504222477287440390234150412680963966e218L, |
| 841 | 0.6466855489220473672507304395536485253155e220L, |
| 842 | 0.8471580690878820510984568758152795681634e222L, |
| 843 | 0.1118248651196004307449963076076169029976e225L, |
| 844 | 0.1487270706090685728908450891181304809868e227L, |
| 845 | 0.1992942746161518876737324194182948445223e229L, |
| 846 | 0.269047270731805048359538766214698040105e231L, |
| 847 | 0.3659042881952548657689727220519893345429e233L, |
| 848 | 0.5012888748274991661034926292112253883237e235L, |
| 849 | 0.6917786472619488492228198283114910358867e237L, |
| 850 | 0.9615723196941089004197195613529725398826e239L, |
| 851 | 0.1346201247571752460587607385894161555836e242L, |
| 852 | 0.1898143759076170969428526414110767793728e244L, |
| 853 | 0.2695364137888162776588507508037290267094e246L, |
| 854 | 0.3854370717180072770521565736493325081944e248L, |
| 855 | 0.5550293832739304789551054660550388118e250L, |
| 856 | 0.80479260574719919448490292577980627711e252L, |
| 857 | 0.1174997204390910823947958271638517164581e255L, |
| 858 | 0.1727245890454638911203498659308620231933e257L, |
| 859 | 0.2556323917872865588581178015776757943262e259L, |
| 860 | 0.380892263763056972698595524350736933546e261L, |
| 861 | 0.571338395644585459047893286526105400319e263L, |
| 862 | 0.8627209774233240431623188626544191544816e265L, |
| 863 | 0.1311335885683452545606724671234717114812e268L, |
| 864 | 0.2006343905095682394778288746989117185662e270L, |
| 865 | 0.308976961384735088795856467036324046592e272L, |
| 866 | 0.4789142901463393876335775239063022722176e274L, |
| 867 | 0.7471062926282894447083809372938315446595e276L, |
| 868 | 0.1172956879426414428192158071551315525115e279L, |
| 869 | 0.1853271869493734796543609753051078529682e281L, |
| 870 | 0.2946702272495038326504339507351214862195e283L, |
| 871 | 0.4714723635992061322406943211761943779512e285L, |
| 872 | 0.7590705053947218729075178570936729485014e287L, |
| 873 | 0.1229694218739449434110178928491750176572e290L, |
| 874 | 0.2004401576545302577599591653441552787813e292L, |
| 875 | 0.3287218585534296227263330311644146572013e294L, |
| 876 | 0.5423910666131588774984495014212841843822e296L, |
| 877 | 0.9003691705778437366474261723593317460744e298L, |
| 878 | 0.1503616514864999040201201707840084015944e301L, |
| 879 | 0.2526075744973198387538018869171341146786e303L, |
| 880 | 0.4269068009004705274939251888899566538069e305L, |
| 881 | 0.7257415615307998967396728211129263114717e307L, |
| 882 | }}; |
| 883 | #endif |
| 884 | |
| 885 | template <> |
| 886 | inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION long double unchecked_factorial<long double>(unsigned i BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(long double)) |
| 887 | { |
| 888 | return unchecked_factorial_data<long double>::factorials[i]; |
| 889 | } |
| 890 | |
| 891 | template <> |
| 892 | struct max_factorial<long double> |
| 893 | { |
| 894 | static constexpr unsigned value = 170; |
| 895 | }; |
| 896 | |
| 897 | #ifdef BOOST_MATH_USE_FLOAT128 |
| 898 | |
| 899 | template <bool b> |
| 900 | struct unchecked_factorial_data<BOOST_MATH_FLOAT128_TYPE, b> |
| 901 | { |
| 902 | #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES |
| 903 | static constexpr std::array<BOOST_MATH_FLOAT128_TYPE, 171> factorials = { { |
| 904 | 1, |
| 905 | 1, |
| 906 | 2, |
| 907 | 6, |
| 908 | 24, |
| 909 | 120, |
| 910 | 720, |
| 911 | 5040, |
| 912 | 40320, |
| 913 | 362880.0Q, |
| 914 | 3628800.0Q, |
| 915 | 39916800.0Q, |
| 916 | 479001600.0Q, |
| 917 | 6227020800.0Q, |
| 918 | 87178291200.0Q, |
| 919 | 1307674368000.0Q, |
| 920 | 20922789888000.0Q, |
| 921 | 355687428096000.0Q, |
| 922 | 6402373705728000.0Q, |
| 923 | 121645100408832000.0Q, |
| 924 | 0.243290200817664e19Q, |
| 925 | 0.5109094217170944e20Q, |
| 926 | 0.112400072777760768e22Q, |
| 927 | 0.2585201673888497664e23Q, |
| 928 | 0.62044840173323943936e24Q, |
| 929 | 0.15511210043330985984e26Q, |
| 930 | 0.403291461126605635584e27Q, |
| 931 | 0.10888869450418352160768e29Q, |
| 932 | 0.304888344611713860501504e30Q, |
| 933 | 0.8841761993739701954543616e31Q, |
| 934 | 0.26525285981219105863630848e33Q, |
| 935 | 0.822283865417792281772556288e34Q, |
| 936 | 0.26313083693369353016721801216e36Q, |
| 937 | 0.868331761881188649551819440128e37Q, |
| 938 | 0.29523279903960414084761860964352e39Q, |
| 939 | 0.103331479663861449296666513375232e41Q, |
| 940 | 0.3719933267899012174679994481508352e42Q, |
| 941 | 0.137637530912263450463159795815809024e44Q, |
| 942 | 0.5230226174666011117600072241000742912e45Q, |
| 943 | 0.203978820811974433586402817399028973568e47Q, |
| 944 | 0.815915283247897734345611269596115894272e48Q, |
| 945 | 0.3345252661316380710817006205344075166515e50Q, |
| 946 | 0.1405006117752879898543142606244511569936e52Q, |
| 947 | 0.6041526306337383563735513206851399750726e53Q, |
| 948 | 0.265827157478844876804362581101461589032e55Q, |
| 949 | 0.1196222208654801945619631614956577150644e57Q, |
| 950 | 0.5502622159812088949850305428800254892962e58Q, |
| 951 | 0.2586232415111681806429643551536119799692e60Q, |
| 952 | 0.1241391559253607267086228904737337503852e62Q, |
| 953 | 0.6082818640342675608722521633212953768876e63Q, |
| 954 | 0.3041409320171337804361260816606476884438e65Q, |
| 955 | 0.1551118753287382280224243016469303211063e67Q, |
| 956 | 0.8065817517094387857166063685640376697529e68Q, |
| 957 | 0.427488328406002556429801375338939964969e70Q, |
| 958 | 0.2308436973392413804720927426830275810833e72Q, |
| 959 | 0.1269640335365827592596510084756651695958e74Q, |
| 960 | 0.7109985878048634518540456474637249497365e75Q, |
| 961 | 0.4052691950487721675568060190543232213498e77Q, |
| 962 | 0.2350561331282878571829474910515074683829e79Q, |
| 963 | 0.1386831185456898357379390197203894063459e81Q, |
| 964 | 0.8320987112741390144276341183223364380754e82Q, |
| 965 | 0.507580213877224798800856812176625227226e84Q, |
| 966 | 0.3146997326038793752565312235495076408801e86Q, |
| 967 | 0.1982608315404440064116146708361898137545e88Q, |
| 968 | 0.1268869321858841641034333893351614808029e90Q, |
| 969 | 0.8247650592082470666723170306785496252186e91Q, |
| 970 | 0.5443449390774430640037292402478427526443e93Q, |
| 971 | 0.3647111091818868528824985909660546442717e95Q, |
| 972 | 0.2480035542436830599600990418569171581047e97Q, |
| 973 | 0.1711224524281413113724683388812728390923e99Q, |
| 974 | 0.1197857166996989179607278372168909873646e101Q, |
| 975 | 0.8504785885678623175211676442399260102886e102Q, |
| 976 | 0.6123445837688608686152407038527467274078e104Q, |
| 977 | 0.4470115461512684340891257138125051110077e106Q, |
| 978 | 0.3307885441519386412259530282212537821457e108Q, |
| 979 | 0.2480914081139539809194647711659403366093e110Q, |
| 980 | 0.188549470166605025498793226086114655823e112Q, |
| 981 | 0.1451830920282858696340707840863082849837e114Q, |
| 982 | 0.1132428117820629783145752115873204622873e116Q, |
| 983 | 0.8946182130782975286851441715398316520698e117Q, |
| 984 | 0.7156945704626380229481153372318653216558e119Q, |
| 985 | 0.5797126020747367985879734231578109105412e121Q, |
| 986 | 0.4753643337012841748421382069894049466438e123Q, |
| 987 | 0.3945523969720658651189747118012061057144e125Q, |
| 988 | 0.3314240134565353266999387579130131288001e127Q, |
| 989 | 0.2817104114380550276949479442260611594801e129Q, |
| 990 | 0.2422709538367273238176552320344125971528e131Q, |
| 991 | 0.210775729837952771721360051869938959523e133Q, |
| 992 | 0.1854826422573984391147968456455462843802e135Q, |
| 993 | 0.1650795516090846108121691926245361930984e137Q, |
| 994 | 0.1485715964481761497309522733620825737886e139Q, |
| 995 | 0.1352001527678402962551665687594951421476e141Q, |
| 996 | 0.1243841405464130725547532432587355307758e143Q, |
| 997 | 0.1156772507081641574759205162306240436215e145Q, |
| 998 | 0.1087366156656743080273652852567866010042e147Q, |
| 999 | 0.103299784882390592625997020993947270954e149Q, |
| 1000 | 0.9916779348709496892095714015418938011582e150Q, |
| 1001 | 0.9619275968248211985332842594956369871234e152Q, |
| 1002 | 0.942689044888324774562618574305724247381e154Q, |
| 1003 | 0.9332621544394415268169923885626670049072e156Q, |
| 1004 | 0.9332621544394415268169923885626670049072e158Q, |
| 1005 | 0.9425947759838359420851623124482936749562e160Q, |
| 1006 | 0.9614466715035126609268655586972595484554e162Q, |
| 1007 | 0.990290071648618040754671525458177334909e164Q, |
| 1008 | 0.1029901674514562762384858386476504428305e167Q, |
| 1009 | 0.1081396758240290900504101305800329649721e169Q, |
| 1010 | 0.1146280563734708354534347384148349428704e171Q, |
| 1011 | 0.1226520203196137939351751701038733888713e173Q, |
| 1012 | 0.132464181945182897449989183712183259981e175Q, |
| 1013 | 0.1443859583202493582204882102462797533793e177Q, |
| 1014 | 0.1588245541522742940425370312709077287172e179Q, |
| 1015 | 0.1762952551090244663872161047107075788761e181Q, |
| 1016 | 0.1974506857221074023536820372759924883413e183Q, |
| 1017 | 0.2231192748659813646596607021218715118256e185Q, |
| 1018 | 0.2543559733472187557120132004189335234812e187Q, |
| 1019 | 0.2925093693493015690688151804817735520034e189Q, |
| 1020 | 0.339310868445189820119825609358857320324e191Q, |
| 1021 | 0.396993716080872089540195962949863064779e193Q, |
| 1022 | 0.4684525849754290656574312362808384164393e195Q, |
| 1023 | 0.5574585761207605881323431711741977155627e197Q, |
| 1024 | 0.6689502913449127057588118054090372586753e199Q, |
| 1025 | 0.8094298525273443739681622845449350829971e201Q, |
| 1026 | 0.9875044200833601362411579871448208012564e203Q, |
| 1027 | 0.1214630436702532967576624324188129585545e206Q, |
| 1028 | 0.1506141741511140879795014161993280686076e208Q, |
| 1029 | 0.1882677176888926099743767702491600857595e210Q, |
| 1030 | 0.237217324288004688567714730513941708057e212Q, |
| 1031 | 0.3012660018457659544809977077527059692324e214Q, |
| 1032 | 0.3856204823625804217356770659234636406175e216Q, |
| 1033 | 0.4974504222477287440390234150412680963966e218Q, |
| 1034 | 0.6466855489220473672507304395536485253155e220Q, |
| 1035 | 0.8471580690878820510984568758152795681634e222Q, |
| 1036 | 0.1118248651196004307449963076076169029976e225Q, |
| 1037 | 0.1487270706090685728908450891181304809868e227Q, |
| 1038 | 0.1992942746161518876737324194182948445223e229Q, |
| 1039 | 0.269047270731805048359538766214698040105e231Q, |
| 1040 | 0.3659042881952548657689727220519893345429e233Q, |
| 1041 | 0.5012888748274991661034926292112253883237e235Q, |
| 1042 | 0.6917786472619488492228198283114910358867e237Q, |
| 1043 | 0.9615723196941089004197195613529725398826e239Q, |
| 1044 | 0.1346201247571752460587607385894161555836e242Q, |
| 1045 | 0.1898143759076170969428526414110767793728e244Q, |
| 1046 | 0.2695364137888162776588507508037290267094e246Q, |
| 1047 | 0.3854370717180072770521565736493325081944e248Q, |
| 1048 | 0.5550293832739304789551054660550388118e250Q, |
| 1049 | 0.80479260574719919448490292577980627711e252Q, |
| 1050 | 0.1174997204390910823947958271638517164581e255Q, |
| 1051 | 0.1727245890454638911203498659308620231933e257Q, |
| 1052 | 0.2556323917872865588581178015776757943262e259Q, |
| 1053 | 0.380892263763056972698595524350736933546e261Q, |
| 1054 | 0.571338395644585459047893286526105400319e263Q, |
| 1055 | 0.8627209774233240431623188626544191544816e265Q, |
| 1056 | 0.1311335885683452545606724671234717114812e268Q, |
| 1057 | 0.2006343905095682394778288746989117185662e270Q, |
| 1058 | 0.308976961384735088795856467036324046592e272Q, |
| 1059 | 0.4789142901463393876335775239063022722176e274Q, |
| 1060 | 0.7471062926282894447083809372938315446595e276Q, |
| 1061 | 0.1172956879426414428192158071551315525115e279Q, |
| 1062 | 0.1853271869493734796543609753051078529682e281Q, |
| 1063 | 0.2946702272495038326504339507351214862195e283Q, |
| 1064 | 0.4714723635992061322406943211761943779512e285Q, |
| 1065 | 0.7590705053947218729075178570936729485014e287Q, |
| 1066 | 0.1229694218739449434110178928491750176572e290Q, |
| 1067 | 0.2004401576545302577599591653441552787813e292Q, |
| 1068 | 0.3287218585534296227263330311644146572013e294Q, |
| 1069 | 0.5423910666131588774984495014212841843822e296Q, |
| 1070 | 0.9003691705778437366474261723593317460744e298Q, |
| 1071 | 0.1503616514864999040201201707840084015944e301Q, |
| 1072 | 0.2526075744973198387538018869171341146786e303Q, |
| 1073 | 0.4269068009004705274939251888899566538069e305Q, |
| 1074 | 0.7257415615307998967396728211129263114717e307Q, |
| 1075 | } }; |
| 1076 | #else |
| 1077 | static const std::array<BOOST_MATH_FLOAT128_TYPE, 171> factorials; |
| 1078 | #endif |
| 1079 | }; |
| 1080 | |
| 1081 | template <bool b> |
| 1082 | #ifdef BOOST_MATH_HAVE_CONSTEXPR_TABLES |
| 1083 | constexpr std::array<BOOST_MATH_FLOAT128_TYPE, 171> unchecked_factorial_data<BOOST_MATH_FLOAT128_TYPE, b>::factorials; |
| 1084 | #else |
| 1085 | const std::array<BOOST_MATH_FLOAT128_TYPE, 171> unchecked_factorial_data<BOOST_MATH_FLOAT128_TYPE, b>::factorials = { { |
| 1086 | 1, |
| 1087 | 1, |
| 1088 | 2, |
| 1089 | 6, |
| 1090 | 24, |
| 1091 | 120, |
| 1092 | 720, |
| 1093 | 5040, |
| 1094 | 40320, |
| 1095 | 362880.0Q, |
| 1096 | 3628800.0Q, |
| 1097 | 39916800.0Q, |
| 1098 | 479001600.0Q, |
| 1099 | 6227020800.0Q, |
| 1100 | 87178291200.0Q, |
| 1101 | 1307674368000.0Q, |
| 1102 | 20922789888000.0Q, |
| 1103 | 355687428096000.0Q, |
| 1104 | 6402373705728000.0Q, |
| 1105 | 121645100408832000.0Q, |
| 1106 | 0.243290200817664e19Q, |
| 1107 | 0.5109094217170944e20Q, |
| 1108 | 0.112400072777760768e22Q, |
| 1109 | 0.2585201673888497664e23Q, |
| 1110 | 0.62044840173323943936e24Q, |
| 1111 | 0.15511210043330985984e26Q, |
| 1112 | 0.403291461126605635584e27Q, |
| 1113 | 0.10888869450418352160768e29Q, |
| 1114 | 0.304888344611713860501504e30Q, |
| 1115 | 0.8841761993739701954543616e31Q, |
| 1116 | 0.26525285981219105863630848e33Q, |
| 1117 | 0.822283865417792281772556288e34Q, |
| 1118 | 0.26313083693369353016721801216e36Q, |
| 1119 | 0.868331761881188649551819440128e37Q, |
| 1120 | 0.29523279903960414084761860964352e39Q, |
| 1121 | 0.103331479663861449296666513375232e41Q, |
| 1122 | 0.3719933267899012174679994481508352e42Q, |
| 1123 | 0.137637530912263450463159795815809024e44Q, |
| 1124 | 0.5230226174666011117600072241000742912e45Q, |
| 1125 | 0.203978820811974433586402817399028973568e47Q, |
| 1126 | 0.815915283247897734345611269596115894272e48Q, |
| 1127 | 0.3345252661316380710817006205344075166515e50Q, |
| 1128 | 0.1405006117752879898543142606244511569936e52Q, |
| 1129 | 0.6041526306337383563735513206851399750726e53Q, |
| 1130 | 0.265827157478844876804362581101461589032e55Q, |
| 1131 | 0.1196222208654801945619631614956577150644e57Q, |
| 1132 | 0.5502622159812088949850305428800254892962e58Q, |
| 1133 | 0.2586232415111681806429643551536119799692e60Q, |
| 1134 | 0.1241391559253607267086228904737337503852e62Q, |
| 1135 | 0.6082818640342675608722521633212953768876e63Q, |
| 1136 | 0.3041409320171337804361260816606476884438e65Q, |
| 1137 | 0.1551118753287382280224243016469303211063e67Q, |
| 1138 | 0.8065817517094387857166063685640376697529e68Q, |
| 1139 | 0.427488328406002556429801375338939964969e70Q, |
| 1140 | 0.2308436973392413804720927426830275810833e72Q, |
| 1141 | 0.1269640335365827592596510084756651695958e74Q, |
| 1142 | 0.7109985878048634518540456474637249497365e75Q, |
| 1143 | 0.4052691950487721675568060190543232213498e77Q, |
| 1144 | 0.2350561331282878571829474910515074683829e79Q, |
| 1145 | 0.1386831185456898357379390197203894063459e81Q, |
| 1146 | 0.8320987112741390144276341183223364380754e82Q, |
| 1147 | 0.507580213877224798800856812176625227226e84Q, |
| 1148 | 0.3146997326038793752565312235495076408801e86Q, |
| 1149 | 0.1982608315404440064116146708361898137545e88Q, |
| 1150 | 0.1268869321858841641034333893351614808029e90Q, |
| 1151 | 0.8247650592082470666723170306785496252186e91Q, |
| 1152 | 0.5443449390774430640037292402478427526443e93Q, |
| 1153 | 0.3647111091818868528824985909660546442717e95Q, |
| 1154 | 0.2480035542436830599600990418569171581047e97Q, |
| 1155 | 0.1711224524281413113724683388812728390923e99Q, |
| 1156 | 0.1197857166996989179607278372168909873646e101Q, |
| 1157 | 0.8504785885678623175211676442399260102886e102Q, |
| 1158 | 0.6123445837688608686152407038527467274078e104Q, |
| 1159 | 0.4470115461512684340891257138125051110077e106Q, |
| 1160 | 0.3307885441519386412259530282212537821457e108Q, |
| 1161 | 0.2480914081139539809194647711659403366093e110Q, |
| 1162 | 0.188549470166605025498793226086114655823e112Q, |
| 1163 | 0.1451830920282858696340707840863082849837e114Q, |
| 1164 | 0.1132428117820629783145752115873204622873e116Q, |
| 1165 | 0.8946182130782975286851441715398316520698e117Q, |
| 1166 | 0.7156945704626380229481153372318653216558e119Q, |
| 1167 | 0.5797126020747367985879734231578109105412e121Q, |
| 1168 | 0.4753643337012841748421382069894049466438e123Q, |
| 1169 | 0.3945523969720658651189747118012061057144e125Q, |
| 1170 | 0.3314240134565353266999387579130131288001e127Q, |
| 1171 | 0.2817104114380550276949479442260611594801e129Q, |
| 1172 | 0.2422709538367273238176552320344125971528e131Q, |
| 1173 | 0.210775729837952771721360051869938959523e133Q, |
| 1174 | 0.1854826422573984391147968456455462843802e135Q, |
| 1175 | 0.1650795516090846108121691926245361930984e137Q, |
| 1176 | 0.1485715964481761497309522733620825737886e139Q, |
| 1177 | 0.1352001527678402962551665687594951421476e141Q, |
| 1178 | 0.1243841405464130725547532432587355307758e143Q, |
| 1179 | 0.1156772507081641574759205162306240436215e145Q, |
| 1180 | 0.1087366156656743080273652852567866010042e147Q, |
| 1181 | 0.103299784882390592625997020993947270954e149Q, |
| 1182 | 0.9916779348709496892095714015418938011582e150Q, |
| 1183 | 0.9619275968248211985332842594956369871234e152Q, |
| 1184 | 0.942689044888324774562618574305724247381e154Q, |
| 1185 | 0.9332621544394415268169923885626670049072e156Q, |
| 1186 | 0.9332621544394415268169923885626670049072e158Q, |
| 1187 | 0.9425947759838359420851623124482936749562e160Q, |
| 1188 | 0.9614466715035126609268655586972595484554e162Q, |
| 1189 | 0.990290071648618040754671525458177334909e164Q, |
| 1190 | 0.1029901674514562762384858386476504428305e167Q, |
| 1191 | 0.1081396758240290900504101305800329649721e169Q, |
| 1192 | 0.1146280563734708354534347384148349428704e171Q, |
| 1193 | 0.1226520203196137939351751701038733888713e173Q, |
| 1194 | 0.132464181945182897449989183712183259981e175Q, |
| 1195 | 0.1443859583202493582204882102462797533793e177Q, |
| 1196 | 0.1588245541522742940425370312709077287172e179Q, |
| 1197 | 0.1762952551090244663872161047107075788761e181Q, |
| 1198 | 0.1974506857221074023536820372759924883413e183Q, |
| 1199 | 0.2231192748659813646596607021218715118256e185Q, |
| 1200 | 0.2543559733472187557120132004189335234812e187Q, |
| 1201 | 0.2925093693493015690688151804817735520034e189Q, |
| 1202 | 0.339310868445189820119825609358857320324e191Q, |
| 1203 | 0.396993716080872089540195962949863064779e193Q, |
| 1204 | 0.4684525849754290656574312362808384164393e195Q, |
| 1205 | 0.5574585761207605881323431711741977155627e197Q, |
| 1206 | 0.6689502913449127057588118054090372586753e199Q, |
| 1207 | 0.8094298525273443739681622845449350829971e201Q, |
| 1208 | 0.9875044200833601362411579871448208012564e203Q, |
| 1209 | 0.1214630436702532967576624324188129585545e206Q, |
| 1210 | 0.1506141741511140879795014161993280686076e208Q, |
| 1211 | 0.1882677176888926099743767702491600857595e210Q, |
| 1212 | 0.237217324288004688567714730513941708057e212Q, |
| 1213 | 0.3012660018457659544809977077527059692324e214Q, |
| 1214 | 0.3856204823625804217356770659234636406175e216Q, |
| 1215 | 0.4974504222477287440390234150412680963966e218Q, |
| 1216 | 0.6466855489220473672507304395536485253155e220Q, |
| 1217 | 0.8471580690878820510984568758152795681634e222Q, |
| 1218 | 0.1118248651196004307449963076076169029976e225Q, |
| 1219 | 0.1487270706090685728908450891181304809868e227Q, |
| 1220 | 0.1992942746161518876737324194182948445223e229Q, |
| 1221 | 0.269047270731805048359538766214698040105e231Q, |
| 1222 | 0.3659042881952548657689727220519893345429e233Q, |
| 1223 | 0.5012888748274991661034926292112253883237e235Q, |
| 1224 | 0.6917786472619488492228198283114910358867e237Q, |
| 1225 | 0.9615723196941089004197195613529725398826e239Q, |
| 1226 | 0.1346201247571752460587607385894161555836e242Q, |
| 1227 | 0.1898143759076170969428526414110767793728e244Q, |
| 1228 | 0.2695364137888162776588507508037290267094e246Q, |
| 1229 | 0.3854370717180072770521565736493325081944e248Q, |
| 1230 | 0.5550293832739304789551054660550388118e250Q, |
| 1231 | 0.80479260574719919448490292577980627711e252Q, |
| 1232 | 0.1174997204390910823947958271638517164581e255Q, |
| 1233 | 0.1727245890454638911203498659308620231933e257Q, |
| 1234 | 0.2556323917872865588581178015776757943262e259Q, |
| 1235 | 0.380892263763056972698595524350736933546e261Q, |
| 1236 | 0.571338395644585459047893286526105400319e263Q, |
| 1237 | 0.8627209774233240431623188626544191544816e265Q, |
| 1238 | 0.1311335885683452545606724671234717114812e268Q, |
| 1239 | 0.2006343905095682394778288746989117185662e270Q, |
| 1240 | 0.308976961384735088795856467036324046592e272Q, |
| 1241 | 0.4789142901463393876335775239063022722176e274Q, |
| 1242 | 0.7471062926282894447083809372938315446595e276Q, |
| 1243 | 0.1172956879426414428192158071551315525115e279Q, |
| 1244 | 0.1853271869493734796543609753051078529682e281Q, |
| 1245 | 0.2946702272495038326504339507351214862195e283Q, |
| 1246 | 0.4714723635992061322406943211761943779512e285Q, |
| 1247 | 0.7590705053947218729075178570936729485014e287Q, |
| 1248 | 0.1229694218739449434110178928491750176572e290Q, |
| 1249 | 0.2004401576545302577599591653441552787813e292Q, |
| 1250 | 0.3287218585534296227263330311644146572013e294Q, |
| 1251 | 0.5423910666131588774984495014212841843822e296Q, |
| 1252 | 0.9003691705778437366474261723593317460744e298Q, |
| 1253 | 0.1503616514864999040201201707840084015944e301Q, |
| 1254 | 0.2526075744973198387538018869171341146786e303Q, |
| 1255 | 0.4269068009004705274939251888899566538069e305Q, |
| 1256 | 0.7257415615307998967396728211129263114717e307Q, |
| 1257 | } }; |
| 1258 | #endif |
| 1259 | |
| 1260 | template <> |
| 1261 | inline BOOST_MATH_CONSTEXPR_TABLE_FUNCTION BOOST_MATH_FLOAT128_TYPE unchecked_factorial<BOOST_MATH_FLOAT128_TYPE>(unsigned i) |
| 1262 | { |
| 1263 | return unchecked_factorial_data<BOOST_MATH_FLOAT128_TYPE>::factorials[i]; |
| 1264 | } |
| 1265 | |
| 1266 | template <> |
| 1267 | struct max_factorial<BOOST_MATH_FLOAT128_TYPE> |
| 1268 | { |
| 1269 | static constexpr unsigned value = 170; |
| 1270 | }; |
| 1271 | |
| 1272 | #endif |
| 1273 | |
| 1274 | template <class T> |
| 1275 | struct unchecked_factorial_initializer |
| 1276 | { |
| 1277 | struct init |
| 1278 | { |
| 1279 | init() |
| 1280 | { |
| 1281 | boost::math::unchecked_factorial<T>(3); |
| 1282 | } |
| 1283 | void force_instantiate()const {} |
| 1284 | }; |
| 1285 | static const init initializer; |
| 1286 | static void force_instantiate() |
| 1287 | { |
| 1288 | initializer.force_instantiate(); |
| 1289 | } |
| 1290 | }; |
| 1291 | |
| 1292 | template <class T> |
| 1293 | const typename unchecked_factorial_initializer<T>::init unchecked_factorial_initializer<T>::initializer; |
| 1294 | |
| 1295 | |
| 1296 | template <class T, int N> |
| 1297 | inline T unchecked_factorial_imp(unsigned i, const std::integral_constant<int, N>&) |
| 1298 | { |
| 1299 | // |
| 1300 | // If you're foolish enough to instantiate factorial |
| 1301 | // on an integer type then you end up here. But this code is |
| 1302 | // only intended for (fixed precision) multiprecision types. |
| 1303 | // |
| 1304 | // Note, factorial<unsigned int>(n) is not implemented |
| 1305 | // because it would overflow integral type T for too small n |
| 1306 | // to be useful. Use instead a floating-point type, |
| 1307 | // and convert to an unsigned type if essential, for example: |
| 1308 | // unsigned int nfac = static_cast<unsigned int>(factorial<double>(n)); |
| 1309 | // See factorial documentation for more detail. |
| 1310 | // |
| 1311 | static_assert(!std::is_integral<T>::value && !std::numeric_limits<T>::is_integer, "Type T must not be an integral type" ); |
| 1312 | |
| 1313 | // We rely on C++11 thread safe initialization here: |
| 1314 | static const std::array<T, 101> factorials = {{ |
| 1315 | T(boost::math::tools::convert_from_string<T>("1" )), |
| 1316 | T(boost::math::tools::convert_from_string<T>("1" )), |
| 1317 | T(boost::math::tools::convert_from_string<T>("2" )), |
| 1318 | T(boost::math::tools::convert_from_string<T>("6" )), |
| 1319 | T(boost::math::tools::convert_from_string<T>("24" )), |
| 1320 | T(boost::math::tools::convert_from_string<T>("120" )), |
| 1321 | T(boost::math::tools::convert_from_string<T>("720" )), |
| 1322 | T(boost::math::tools::convert_from_string<T>("5040" )), |
| 1323 | T(boost::math::tools::convert_from_string<T>("40320" )), |
| 1324 | T(boost::math::tools::convert_from_string<T>("362880" )), |
| 1325 | T(boost::math::tools::convert_from_string<T>("3628800" )), |
| 1326 | T(boost::math::tools::convert_from_string<T>("39916800" )), |
| 1327 | T(boost::math::tools::convert_from_string<T>("479001600" )), |
| 1328 | T(boost::math::tools::convert_from_string<T>("6227020800" )), |
| 1329 | T(boost::math::tools::convert_from_string<T>("87178291200" )), |
| 1330 | T(boost::math::tools::convert_from_string<T>("1307674368000" )), |
| 1331 | T(boost::math::tools::convert_from_string<T>("20922789888000" )), |
| 1332 | T(boost::math::tools::convert_from_string<T>("355687428096000" )), |
| 1333 | T(boost::math::tools::convert_from_string<T>("6402373705728000" )), |
| 1334 | T(boost::math::tools::convert_from_string<T>("121645100408832000" )), |
| 1335 | T(boost::math::tools::convert_from_string<T>("2432902008176640000" )), |
| 1336 | T(boost::math::tools::convert_from_string<T>("51090942171709440000" )), |
| 1337 | T(boost::math::tools::convert_from_string<T>("1124000727777607680000" )), |
| 1338 | T(boost::math::tools::convert_from_string<T>("25852016738884976640000" )), |
| 1339 | T(boost::math::tools::convert_from_string<T>("620448401733239439360000" )), |
| 1340 | T(boost::math::tools::convert_from_string<T>("15511210043330985984000000" )), |
| 1341 | T(boost::math::tools::convert_from_string<T>("403291461126605635584000000" )), |
| 1342 | T(boost::math::tools::convert_from_string<T>("10888869450418352160768000000" )), |
| 1343 | T(boost::math::tools::convert_from_string<T>("304888344611713860501504000000" )), |
| 1344 | T(boost::math::tools::convert_from_string<T>("8841761993739701954543616000000" )), |
| 1345 | T(boost::math::tools::convert_from_string<T>("265252859812191058636308480000000" )), |
| 1346 | T(boost::math::tools::convert_from_string<T>("8222838654177922817725562880000000" )), |
| 1347 | T(boost::math::tools::convert_from_string<T>("263130836933693530167218012160000000" )), |
| 1348 | T(boost::math::tools::convert_from_string<T>("8683317618811886495518194401280000000" )), |
| 1349 | T(boost::math::tools::convert_from_string<T>("295232799039604140847618609643520000000" )), |
| 1350 | T(boost::math::tools::convert_from_string<T>("10333147966386144929666651337523200000000" )), |
| 1351 | T(boost::math::tools::convert_from_string<T>("371993326789901217467999448150835200000000" )), |
| 1352 | T(boost::math::tools::convert_from_string<T>("13763753091226345046315979581580902400000000" )), |
| 1353 | T(boost::math::tools::convert_from_string<T>("523022617466601111760007224100074291200000000" )), |
| 1354 | T(boost::math::tools::convert_from_string<T>("20397882081197443358640281739902897356800000000" )), |
| 1355 | T(boost::math::tools::convert_from_string<T>("815915283247897734345611269596115894272000000000" )), |
| 1356 | T(boost::math::tools::convert_from_string<T>("33452526613163807108170062053440751665152000000000" )), |
| 1357 | T(boost::math::tools::convert_from_string<T>("1405006117752879898543142606244511569936384000000000" )), |
| 1358 | T(boost::math::tools::convert_from_string<T>("60415263063373835637355132068513997507264512000000000" )), |
| 1359 | T(boost::math::tools::convert_from_string<T>("2658271574788448768043625811014615890319638528000000000" )), |
| 1360 | T(boost::math::tools::convert_from_string<T>("119622220865480194561963161495657715064383733760000000000" )), |
| 1361 | T(boost::math::tools::convert_from_string<T>("5502622159812088949850305428800254892961651752960000000000" )), |
| 1362 | T(boost::math::tools::convert_from_string<T>("258623241511168180642964355153611979969197632389120000000000" )), |
| 1363 | T(boost::math::tools::convert_from_string<T>("12413915592536072670862289047373375038521486354677760000000000" )), |
| 1364 | T(boost::math::tools::convert_from_string<T>("608281864034267560872252163321295376887552831379210240000000000" )), |
| 1365 | T(boost::math::tools::convert_from_string<T>("30414093201713378043612608166064768844377641568960512000000000000" )), |
| 1366 | T(boost::math::tools::convert_from_string<T>("1551118753287382280224243016469303211063259720016986112000000000000" )), |
| 1367 | T(boost::math::tools::convert_from_string<T>("80658175170943878571660636856403766975289505440883277824000000000000" )), |
| 1368 | T(boost::math::tools::convert_from_string<T>("4274883284060025564298013753389399649690343788366813724672000000000000" )), |
| 1369 | T(boost::math::tools::convert_from_string<T>("230843697339241380472092742683027581083278564571807941132288000000000000" )), |
| 1370 | T(boost::math::tools::convert_from_string<T>("12696403353658275925965100847566516959580321051449436762275840000000000000" )), |
| 1371 | T(boost::math::tools::convert_from_string<T>("710998587804863451854045647463724949736497978881168458687447040000000000000" )), |
| 1372 | T(boost::math::tools::convert_from_string<T>("40526919504877216755680601905432322134980384796226602145184481280000000000000" )), |
| 1373 | T(boost::math::tools::convert_from_string<T>("2350561331282878571829474910515074683828862318181142924420699914240000000000000" )), |
| 1374 | T(boost::math::tools::convert_from_string<T>("138683118545689835737939019720389406345902876772687432540821294940160000000000000" )), |
| 1375 | T(boost::math::tools::convert_from_string<T>("8320987112741390144276341183223364380754172606361245952449277696409600000000000000" )), |
| 1376 | T(boost::math::tools::convert_from_string<T>("507580213877224798800856812176625227226004528988036003099405939480985600000000000000" )), |
| 1377 | T(boost::math::tools::convert_from_string<T>("31469973260387937525653122354950764088012280797258232192163168247821107200000000000000" )), |
| 1378 | T(boost::math::tools::convert_from_string<T>("1982608315404440064116146708361898137544773690227268628106279599612729753600000000000000" )), |
| 1379 | T(boost::math::tools::convert_from_string<T>("126886932185884164103433389335161480802865516174545192198801894375214704230400000000000000" )), |
| 1380 | T(boost::math::tools::convert_from_string<T>("8247650592082470666723170306785496252186258551345437492922123134388955774976000000000000000" )), |
| 1381 | T(boost::math::tools::convert_from_string<T>("544344939077443064003729240247842752644293064388798874532860126869671081148416000000000000000" )), |
| 1382 | T(boost::math::tools::convert_from_string<T>("36471110918188685288249859096605464427167635314049524593701628500267962436943872000000000000000" )), |
| 1383 | T(boost::math::tools::convert_from_string<T>("2480035542436830599600990418569171581047399201355367672371710738018221445712183296000000000000000" )), |
| 1384 | T(boost::math::tools::convert_from_string<T>("171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000" )), |
| 1385 | T(boost::math::tools::convert_from_string<T>("11978571669969891796072783721689098736458938142546425857555362864628009582789845319680000000000000000" )), |
| 1386 | T(boost::math::tools::convert_from_string<T>("850478588567862317521167644239926010288584608120796235886430763388588680378079017697280000000000000000" )), |
| 1387 | T(boost::math::tools::convert_from_string<T>("61234458376886086861524070385274672740778091784697328983823014963978384987221689274204160000000000000000" )), |
| 1388 | T(boost::math::tools::convert_from_string<T>("4470115461512684340891257138125051110076800700282905015819080092370422104067183317016903680000000000000000" )), |
| 1389 | T(boost::math::tools::convert_from_string<T>("330788544151938641225953028221253782145683251820934971170611926835411235700971565459250872320000000000000000" )), |
| 1390 | T(boost::math::tools::convert_from_string<T>("24809140811395398091946477116594033660926243886570122837795894512655842677572867409443815424000000000000000000" )), |
| 1391 | T(boost::math::tools::convert_from_string<T>("1885494701666050254987932260861146558230394535379329335672487982961844043495537923117729972224000000000000000000" )), |
| 1392 | T(boost::math::tools::convert_from_string<T>("145183092028285869634070784086308284983740379224208358846781574688061991349156420080065207861248000000000000000000" )), |
| 1393 | T(boost::math::tools::convert_from_string<T>("11324281178206297831457521158732046228731749579488251990048962825668835325234200766245086213177344000000000000000000" )), |
| 1394 | T(boost::math::tools::convert_from_string<T>("894618213078297528685144171539831652069808216779571907213868063227837990693501860533361810841010176000000000000000000" )), |
| 1395 | T(boost::math::tools::convert_from_string<T>("71569457046263802294811533723186532165584657342365752577109445058227039255480148842668944867280814080000000000000000000" )), |
| 1396 | T(boost::math::tools::convert_from_string<T>("5797126020747367985879734231578109105412357244731625958745865049716390179693892056256184534249745940480000000000000000000" )), |
| 1397 | T(boost::math::tools::convert_from_string<T>("475364333701284174842138206989404946643813294067993328617160934076743994734899148613007131808479167119360000000000000000000" )), |
| 1398 | T(boost::math::tools::convert_from_string<T>("39455239697206586511897471180120610571436503407643446275224357528369751562996629334879591940103770870906880000000000000000000" )), |
| 1399 | T(boost::math::tools::convert_from_string<T>("3314240134565353266999387579130131288000666286242049487118846032383059131291716864129885722968716753156177920000000000000000000" )), |
| 1400 | T(boost::math::tools::convert_from_string<T>("281710411438055027694947944226061159480056634330574206405101912752560026159795933451040286452340924018275123200000000000000000000" )), |
| 1401 | T(boost::math::tools::convert_from_string<T>("24227095383672732381765523203441259715284870552429381750838764496720162249742450276789464634901319465571660595200000000000000000000" )), |
| 1402 | T(boost::math::tools::convert_from_string<T>("2107757298379527717213600518699389595229783738061356212322972511214654115727593174080683423236414793504734471782400000000000000000000" )), |
| 1403 | T(boost::math::tools::convert_from_string<T>("185482642257398439114796845645546284380220968949399346684421580986889562184028199319100141244804501828416633516851200000000000000000000" )), |
| 1404 | T(boost::math::tools::convert_from_string<T>("16507955160908461081216919262453619309839666236496541854913520707833171034378509739399912570787600662729080382999756800000000000000000000" )), |
| 1405 | T(boost::math::tools::convert_from_string<T>("1485715964481761497309522733620825737885569961284688766942216863704985393094065876545992131370884059645617234469978112000000000000000000000" )), |
| 1406 | T(boost::math::tools::convert_from_string<T>("135200152767840296255166568759495142147586866476906677791741734597153670771559994765685283954750449427751168336768008192000000000000000000000" )), |
| 1407 | T(boost::math::tools::convert_from_string<T>("12438414054641307255475324325873553077577991715875414356840239582938137710983519518443046123837041347353107486982656753664000000000000000000000" )), |
| 1408 | T(boost::math::tools::convert_from_string<T>("1156772507081641574759205162306240436214753229576413535186142281213246807121467315215203289516844845303838996289387078090752000000000000000000000" )), |
| 1409 | T(boost::math::tools::convert_from_string<T>("108736615665674308027365285256786601004186803580182872307497374434045199869417927630229109214583415458560865651202385340530688000000000000000000000" )), |
| 1410 | T(boost::math::tools::convert_from_string<T>("10329978488239059262599702099394727095397746340117372869212250571234293987594703124871765375385424468563282236864226607350415360000000000000000000000" )), |
| 1411 | T(boost::math::tools::convert_from_string<T>("991677934870949689209571401541893801158183648651267795444376054838492222809091499987689476037000748982075094738965754305639874560000000000000000000000" )), |
| 1412 | T(boost::math::tools::convert_from_string<T>("96192759682482119853328425949563698712343813919172976158104477319333745612481875498805879175589072651261284189679678167647067832320000000000000000000000" )), |
| 1413 | T(boost::math::tools::convert_from_string<T>("9426890448883247745626185743057242473809693764078951663494238777294707070023223798882976159207729119823605850588608460429412647567360000000000000000000000" )), |
| 1414 | T(boost::math::tools::convert_from_string<T>("933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000" )), |
| 1415 | T(boost::math::tools::convert_from_string<T>("93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000" )), |
| 1416 | }}; |
| 1417 | |
| 1418 | return factorials[i]; |
| 1419 | } |
| 1420 | |
| 1421 | template <class T> |
| 1422 | inline T unchecked_factorial_imp(unsigned i, const std::integral_constant<int, 0>&) |
| 1423 | { |
| 1424 | // |
| 1425 | // If you're foolish enough to instantiate factorial |
| 1426 | // on an integer type then you end up here. But this code is |
| 1427 | // only intended for (variable precision) multiprecision types. |
| 1428 | // |
| 1429 | // Note, factorial<unsigned int>(n) is not implemented |
| 1430 | // because it would overflow integral type T for too small n |
| 1431 | // to be useful. Use instead a floating-point type, |
| 1432 | // and convert to an unsigned type if essential, for example: |
| 1433 | // unsigned int nfac = static_cast<unsigned int>(factorial<double>(n)); |
| 1434 | // See factorial documentation for more detail. |
| 1435 | // |
| 1436 | static_assert(!std::is_integral<T>::value && !std::numeric_limits<T>::is_integer, "Type T must not be an integral type" ); |
| 1437 | |
| 1438 | static const char* const factorial_strings[] = { |
| 1439 | "1" , |
| 1440 | "1" , |
| 1441 | "2" , |
| 1442 | "6" , |
| 1443 | "24" , |
| 1444 | "120" , |
| 1445 | "720" , |
| 1446 | "5040" , |
| 1447 | "40320" , |
| 1448 | "362880" , |
| 1449 | "3628800" , |
| 1450 | "39916800" , |
| 1451 | "479001600" , |
| 1452 | "6227020800" , |
| 1453 | "87178291200" , |
| 1454 | "1307674368000" , |
| 1455 | "20922789888000" , |
| 1456 | "355687428096000" , |
| 1457 | "6402373705728000" , |
| 1458 | "121645100408832000" , |
| 1459 | "2432902008176640000" , |
| 1460 | "51090942171709440000" , |
| 1461 | "1124000727777607680000" , |
| 1462 | "25852016738884976640000" , |
| 1463 | "620448401733239439360000" , |
| 1464 | "15511210043330985984000000" , |
| 1465 | "403291461126605635584000000" , |
| 1466 | "10888869450418352160768000000" , |
| 1467 | "304888344611713860501504000000" , |
| 1468 | "8841761993739701954543616000000" , |
| 1469 | "265252859812191058636308480000000" , |
| 1470 | "8222838654177922817725562880000000" , |
| 1471 | "263130836933693530167218012160000000" , |
| 1472 | "8683317618811886495518194401280000000" , |
| 1473 | "295232799039604140847618609643520000000" , |
| 1474 | "10333147966386144929666651337523200000000" , |
| 1475 | "371993326789901217467999448150835200000000" , |
| 1476 | "13763753091226345046315979581580902400000000" , |
| 1477 | "523022617466601111760007224100074291200000000" , |
| 1478 | "20397882081197443358640281739902897356800000000" , |
| 1479 | "815915283247897734345611269596115894272000000000" , |
| 1480 | "33452526613163807108170062053440751665152000000000" , |
| 1481 | "1405006117752879898543142606244511569936384000000000" , |
| 1482 | "60415263063373835637355132068513997507264512000000000" , |
| 1483 | "2658271574788448768043625811014615890319638528000000000" , |
| 1484 | "119622220865480194561963161495657715064383733760000000000" , |
| 1485 | "5502622159812088949850305428800254892961651752960000000000" , |
| 1486 | "258623241511168180642964355153611979969197632389120000000000" , |
| 1487 | "12413915592536072670862289047373375038521486354677760000000000" , |
| 1488 | "608281864034267560872252163321295376887552831379210240000000000" , |
| 1489 | "30414093201713378043612608166064768844377641568960512000000000000" , |
| 1490 | "1551118753287382280224243016469303211063259720016986112000000000000" , |
| 1491 | "80658175170943878571660636856403766975289505440883277824000000000000" , |
| 1492 | "4274883284060025564298013753389399649690343788366813724672000000000000" , |
| 1493 | "230843697339241380472092742683027581083278564571807941132288000000000000" , |
| 1494 | "12696403353658275925965100847566516959580321051449436762275840000000000000" , |
| 1495 | "710998587804863451854045647463724949736497978881168458687447040000000000000" , |
| 1496 | "40526919504877216755680601905432322134980384796226602145184481280000000000000" , |
| 1497 | "2350561331282878571829474910515074683828862318181142924420699914240000000000000" , |
| 1498 | "138683118545689835737939019720389406345902876772687432540821294940160000000000000" , |
| 1499 | "8320987112741390144276341183223364380754172606361245952449277696409600000000000000" , |
| 1500 | "507580213877224798800856812176625227226004528988036003099405939480985600000000000000" , |
| 1501 | "31469973260387937525653122354950764088012280797258232192163168247821107200000000000000" , |
| 1502 | "1982608315404440064116146708361898137544773690227268628106279599612729753600000000000000" , |
| 1503 | "126886932185884164103433389335161480802865516174545192198801894375214704230400000000000000" , |
| 1504 | "8247650592082470666723170306785496252186258551345437492922123134388955774976000000000000000" , |
| 1505 | "544344939077443064003729240247842752644293064388798874532860126869671081148416000000000000000" , |
| 1506 | "36471110918188685288249859096605464427167635314049524593701628500267962436943872000000000000000" , |
| 1507 | "2480035542436830599600990418569171581047399201355367672371710738018221445712183296000000000000000" , |
| 1508 | "171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000" , |
| 1509 | "11978571669969891796072783721689098736458938142546425857555362864628009582789845319680000000000000000" , |
| 1510 | "850478588567862317521167644239926010288584608120796235886430763388588680378079017697280000000000000000" , |
| 1511 | "61234458376886086861524070385274672740778091784697328983823014963978384987221689274204160000000000000000" , |
| 1512 | "4470115461512684340891257138125051110076800700282905015819080092370422104067183317016903680000000000000000" , |
| 1513 | "330788544151938641225953028221253782145683251820934971170611926835411235700971565459250872320000000000000000" , |
| 1514 | "24809140811395398091946477116594033660926243886570122837795894512655842677572867409443815424000000000000000000" , |
| 1515 | "1885494701666050254987932260861146558230394535379329335672487982961844043495537923117729972224000000000000000000" , |
| 1516 | "145183092028285869634070784086308284983740379224208358846781574688061991349156420080065207861248000000000000000000" , |
| 1517 | "11324281178206297831457521158732046228731749579488251990048962825668835325234200766245086213177344000000000000000000" , |
| 1518 | "894618213078297528685144171539831652069808216779571907213868063227837990693501860533361810841010176000000000000000000" , |
| 1519 | "71569457046263802294811533723186532165584657342365752577109445058227039255480148842668944867280814080000000000000000000" , |
| 1520 | "5797126020747367985879734231578109105412357244731625958745865049716390179693892056256184534249745940480000000000000000000" , |
| 1521 | "475364333701284174842138206989404946643813294067993328617160934076743994734899148613007131808479167119360000000000000000000" , |
| 1522 | "39455239697206586511897471180120610571436503407643446275224357528369751562996629334879591940103770870906880000000000000000000" , |
| 1523 | "3314240134565353266999387579130131288000666286242049487118846032383059131291716864129885722968716753156177920000000000000000000" , |
| 1524 | "281710411438055027694947944226061159480056634330574206405101912752560026159795933451040286452340924018275123200000000000000000000" , |
| 1525 | "24227095383672732381765523203441259715284870552429381750838764496720162249742450276789464634901319465571660595200000000000000000000" , |
| 1526 | "2107757298379527717213600518699389595229783738061356212322972511214654115727593174080683423236414793504734471782400000000000000000000" , |
| 1527 | "185482642257398439114796845645546284380220968949399346684421580986889562184028199319100141244804501828416633516851200000000000000000000" , |
| 1528 | "16507955160908461081216919262453619309839666236496541854913520707833171034378509739399912570787600662729080382999756800000000000000000000" , |
| 1529 | "1485715964481761497309522733620825737885569961284688766942216863704985393094065876545992131370884059645617234469978112000000000000000000000" , |
| 1530 | "135200152767840296255166568759495142147586866476906677791741734597153670771559994765685283954750449427751168336768008192000000000000000000000" , |
| 1531 | "12438414054641307255475324325873553077577991715875414356840239582938137710983519518443046123837041347353107486982656753664000000000000000000000" , |
| 1532 | "1156772507081641574759205162306240436214753229576413535186142281213246807121467315215203289516844845303838996289387078090752000000000000000000000" , |
| 1533 | "108736615665674308027365285256786601004186803580182872307497374434045199869417927630229109214583415458560865651202385340530688000000000000000000000" , |
| 1534 | "10329978488239059262599702099394727095397746340117372869212250571234293987594703124871765375385424468563282236864226607350415360000000000000000000000" , |
| 1535 | "991677934870949689209571401541893801158183648651267795444376054838492222809091499987689476037000748982075094738965754305639874560000000000000000000000" , |
| 1536 | "96192759682482119853328425949563698712343813919172976158104477319333745612481875498805879175589072651261284189679678167647067832320000000000000000000000" , |
| 1537 | "9426890448883247745626185743057242473809693764078951663494238777294707070023223798882976159207729119823605850588608460429412647567360000000000000000000000" , |
| 1538 | "933262154439441526816992388562667004907159682643816214685929638952175999932299156089414639761565182862536979208272237582511852109168640000000000000000000000" , |
| 1539 | "93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000" , |
| 1540 | }; |
| 1541 | // |
| 1542 | // we rely on C++11 thread safe initialization in the event that we have no thread locals: |
| 1543 | // |
| 1544 | static BOOST_MATH_THREAD_LOCAL T factorials[sizeof(factorial_strings) / sizeof(factorial_strings[0])]; |
| 1545 | static BOOST_MATH_THREAD_LOCAL int digits = 0; |
| 1546 | |
| 1547 | int current_digits = boost::math::tools::digits<T>(); |
| 1548 | |
| 1549 | if(digits != current_digits) |
| 1550 | { |
| 1551 | digits = current_digits; |
| 1552 | for(unsigned k = 0; k < sizeof(factorials) / sizeof(factorials[0]); ++k) |
| 1553 | factorials[k] = static_cast<T>(boost::math::tools::convert_from_string<T>(factorial_strings[k])); |
| 1554 | } |
| 1555 | |
| 1556 | return factorials[i]; |
| 1557 | } |
| 1558 | |
| 1559 | template <class T> |
| 1560 | inline T unchecked_factorial_imp(unsigned i, const std::integral_constant<int, std::numeric_limits<float>::digits>&) |
| 1561 | { |
| 1562 | return unchecked_factorial<float>(i); |
| 1563 | } |
| 1564 | |
| 1565 | template <class T> |
| 1566 | inline T unchecked_factorial_imp(unsigned i, const std::integral_constant<int, std::numeric_limits<double>::digits>&) |
| 1567 | { |
| 1568 | return unchecked_factorial<double>(i); |
| 1569 | } |
| 1570 | |
| 1571 | #if DBL_MANT_DIG != LDBL_MANT_DIG |
| 1572 | template <class T> |
| 1573 | inline T unchecked_factorial_imp(unsigned i, const std::integral_constant<int, LDBL_MANT_DIG>&) |
| 1574 | { |
| 1575 | return unchecked_factorial<long double>(i); |
| 1576 | } |
| 1577 | #endif |
| 1578 | #ifdef BOOST_MATH_USE_FLOAT128 |
| 1579 | template <class T> |
| 1580 | inline T unchecked_factorial_imp(unsigned i, const std::integral_constant<int, 113>&) |
| 1581 | { |
| 1582 | return unchecked_factorial<BOOST_MATH_FLOAT128_TYPE>(i); |
| 1583 | } |
| 1584 | #endif |
| 1585 | |
| 1586 | template <class T> |
| 1587 | inline T unchecked_factorial(unsigned i) |
| 1588 | { |
| 1589 | typedef typename boost::math::policies::precision<T, boost::math::policies::policy<> >::type tag_type; |
| 1590 | return unchecked_factorial_imp<T>(i, tag_type()); |
| 1591 | } |
| 1592 | |
| 1593 | #ifdef BOOST_MATH_USE_FLOAT128 |
| 1594 | #define BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL : std::numeric_limits<T>::digits == 113 ? max_factorial<BOOST_MATH_FLOAT128_TYPE>::value |
| 1595 | #else |
| 1596 | #define BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL |
| 1597 | #endif |
| 1598 | |
| 1599 | template <class T> |
| 1600 | struct max_factorial |
| 1601 | { |
| 1602 | static constexpr unsigned value = |
| 1603 | std::numeric_limits<T>::digits == std::numeric_limits<float>::digits ? max_factorial<float>::value |
| 1604 | : std::numeric_limits<T>::digits == std::numeric_limits<double>::digits ? max_factorial<double>::value |
| 1605 | : std::numeric_limits<T>::digits == std::numeric_limits<long double>::digits ? max_factorial<long double>::value |
| 1606 | BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL |
| 1607 | : 100; |
| 1608 | }; |
| 1609 | |
| 1610 | #undef BOOST_MATH_DETAIL_FLOAT128_MAX_FACTORIAL |
| 1611 | |
| 1612 | #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION |
| 1613 | template <class T> |
| 1614 | constexpr unsigned max_factorial<T>::value; |
| 1615 | #endif |
| 1616 | |
| 1617 | } // namespace math |
| 1618 | } // namespace boost |
| 1619 | |
| 1620 | #endif // BOOST_MATH_SP_UC_FACTORIALS_HPP |
| 1621 | |
| 1622 | |