Created
March 25, 2018 03:03
-
-
Save jniemann66/745f0af5e50f64ceebe57f358a8a3e9c to your computer and use it in GitHub Desktop.
Factorial lookup table constants (double and quad precision)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// factorial.h : table of factorial constants | |
// note: to use quad-precision with GCC, compile with | |
// -std=gnu++11 -lquadmath | |
#ifndef FACTORIAL_H | |
#define FACTORIAL_H | |
#define FACTORIAL_TABLE_DOUBLE_COUNT 60 | |
#define FACTORIAL_TABLE_QUAD_COUNT 170 | |
// table of double-precision factorials: | |
const double factorial[FACTORIAL_TABLE_DOUBLE_COUNT] = { | |
1 , // +1.00000000000000000000000000000000000e+00 | |
1 , // +1.00000000000000000000000000000000000e+00 | |
2 , // +2.00000000000000000000000000000000000e+00 | |
6 , // +6.00000000000000000000000000000000000e+00 | |
24 , // +2.40000000000000000000000000000000000e+01 | |
120 , // +1.20000000000000000000000000000000000e+02 | |
720 , // +7.20000000000000000000000000000000000e+02 | |
5040 , // +5.04000000000000000000000000000000000e+03 | |
40320 , // +4.03200000000000000000000000000000000e+04 | |
362880 , // +3.62880000000000000000000000000000000e+05 | |
3628800 , // +3.62880000000000000000000000000000000e+06 | |
39916800 , // +3.99168000000000000000000000000000000e+07 | |
479001600 , // +4.79001600000000000000000000000000000e+08 | |
6227020800 , // +6.22702080000000000000000000000000000e+09 | |
87178291200 , // +8.71782912000000000000000000000000000e+10 | |
1307674368000 , // +1.30767436800000000000000000000000000e+12 | |
20922789888000 , // +2.09227898880000000000000000000000000e+13 | |
355687428096000 , // +3.55687428096000000000000000000000000e+14 | |
6402373705728000 , // +6.40237370572800000000000000000000000e+15 | |
1.21645100408832e+17 , // +1.21645100408832000000000000000000000e+17 | |
2.43290200817664e+18 , // +2.43290200817664000000000000000000000e+18 | |
5.109094217170944e+19 , // +5.10909421717094400000000000000000000e+19 | |
// | |
1.124000727777608e+21 , // +1.12400072777760768000000000000000000e+21 | |
2.585201673888498e+22 , // +2.58520167388849766400000000000000000e+22 | |
6.204484017332394e+23 , // +6.20448401733239439360000000000000000e+23 | |
1.551121004333099e+25 , // +1.55112100433309859840000000000000000e+25 | |
4.032914611266057e+26 , // +4.03291461126605635584000000000000000e+26 | |
1.088886945041835e+28 , // +1.08888694504183521607680000000000000e+28 | |
3.048883446117139e+29 , // +3.04888344611713860501504000000000000e+29 | |
8.841761993739702e+30 , // +8.84176199373970195454361600000000000e+30 | |
2.652528598121911e+32 , // +2.65252859812191058636308480000000000e+32 | |
8.222838654177922e+33 , // +8.22283865417792281772556288000000000e+33 | |
2.631308369336935e+35 , // +2.63130836933693530167218012160000000e+35 | |
8.683317618811886e+36 , // +8.68331761881188649551819440128000000e+36 | |
2.952327990396042e+38 , // +2.95232799039604140847618609643520000e+38 | |
1.033314796638615e+40 , // +1.03331479663861449296666513375232000e+40 | |
3.719933267899013e+41 , // +3.71993326789901217467999448150835200e+41 | |
1.376375309122635e+43 , // +1.37637530912263450463159795815809024e+43 | |
5.230226174666011e+44 , // +5.23022617466601111760007224100074326e+44 | |
2.039788208119744e+46 , // +2.03978820811974433586402817399028990e+46 | |
8.159152832478977e+47 , // +8.15915283247897734345611269596115994e+47 | |
3.345252661316381e+49 , // +3.34525266131638071081700620534407553e+49 | |
1.40500611775288e+51 , // +1.40500611775287989854314260624451167e+51 | |
6.041526306337383e+52 , // +6.04152630633738356373551320685140054e+52 | |
2.658271574788449e+54 , // +2.65827157478844876804362581101461616e+54 | |
1.196222208654802e+56 , // +1.19622220865480194561963161495657732e+56 | |
5.502622159812089e+57 , // +5.50262215981208894985030542880025565e+57 | |
2.586232415111682e+59 , // +2.58623241511168180642964355153612013e+59 | |
1.241391559253607e+61 , // +1.24139155925360726708622890473733766e+61 | |
6.082818640342675e+62 , // +6.08281864034267560872252163321295418e+62 | |
3.041409320171338e+64 , // +3.04140932017133780436126081660647707e+64 | |
1.551118753287382e+66 , // +1.55111875328738228022424301646930328e+66 | |
8.065817517094388e+67 , // +8.06581751709438785716606368564037680e+67 | |
4.274883284060025e+69 , // +4.27488328406002556429801375338939947e+69 | |
2.308436973392414e+71 , // +2.30843697339241380472092742683027573e+71 | |
1.269640335365828e+73 , // +1.26964033536582759259651008475665158e+73 | |
7.109985878048635e+74 , // +7.10998587804863451854045647463724864e+74 | |
4.052691950487721e+76 , // +4.05269195048772167556806019054323162e+76 | |
2.350561331282878e+78 , // +2.35056133128287857182947491051507425e+78 | |
1.386831185456898e+80 // +1.38683118545689835737939019720389389e+80 | |
}; | |
// table of Quad-Precision Factorials as Hexfloats: | |
#ifdef USE_QUADMATH | |
const __float128 factorialq[FACTORIAL_TABLE_QUAD_COUNT] = | |
{ | |
0x1p+0Q, | |
0x1p+0Q, | |
0x1p+1Q, | |
0x1.8p+2Q, | |
0x1.8p+4Q, | |
0x1.ep+6Q, | |
0x1.68p+9Q, | |
0x1.3bp+12Q, | |
0x1.3bp+15Q, | |
0x1.626p+18Q, | |
0x1.baf8p+21Q, | |
0x1.308a8p+25Q, | |
0x1.c8cfcp+28Q, | |
0x1.7328ccp+32Q, | |
0x1.44c3b28p+36Q, | |
0x1.30777758p+40Q, | |
0x1.30777758p+44Q, | |
0x1.437eeecd8p+48Q, | |
0x1.6beecca73p+52Q, | |
0x1.b02b930689p+56Q, | |
0x1.0e1b3be415ap+61Q, | |
0x1.6283be9b5c62p+65Q, | |
0x1.e77526159f06cp+69Q, | |
0x1.5e5c335f8a4cdap+74Q, | |
0x1.06c52687a7b9a38p+79Q, | |
0x1.9a940c33f6120f78p+83Q, | |
0x1.4d9849ea37eeac918p+88Q, | |
0x1.19787e5d9f31619ac4p+93Q, | |
0x1.ec92dd23d6966aced7p+97Q, | |
0x1.be6518687a7850cb72d8p+102Q, | |
0x1.a27ec6e1f2d0cbbebbaa8p+107Q, | |
0x1.956ad0aae33a4560c5cd2cp+112Q, | |
0x1.956ad0aae33a4560c5cd2cp+117Q, | |
0x1.a21627303a54178bcbfb956p+122Q, | |
0x1.bc3789a33df9590488bb4eb6p+127Q, | |
0x1.e5dcbe8a8bc8b95cf58cde171p+132Q, | |
0x1.114c2b2deea0e8444a1f3cecf9p+138Q, | |
0x1.3c0011ed1bea0c8ef5b41e71ffe8p+143Q, | |
0x1.774015499125eee9c3c5e4275fe4p+148Q, | |
0x1.c95619f1a8e63b2ce6992e0ffcdep+153Q, | |
0x1.1dd5d037098fe4fc101fbcc9fe0bp+159Q, | |
0x1.6e39f2c684405d62f4a8a9e2cd7ep+164Q, | |
0x1.e0ac0ea48d947a91e11d5ef9adb5p+169Q, | |
0x1.42f399d68f1fc25a033fbbcfc0b6p+175Q, | |
0x1.bc0ef38704cbab3bc477a23da8fap+180Q, | |
0x1.383a833aef5f346606241e135adp+186Q, | |
0x1.c0d41ca4b818db52a8d3eb3bd28bp+191Q, | |
0x1.499bc508f7324110b3fba0bfee9ep+197Q, | |
0x1.ee69a78d72cb61990df9711fe5edp+202Q, | |
0x1.7a88e4484be3b6b92eb2fa9c6c09p+208Q, | |
0x1.27baf2587b49e6c0ac7bd3ca3467p+214Q, | |
0x1.d751f23d047dc7c312e5598a4384p+219Q, | |
0x1.7ef294d193a6324e7f5a58c056dbp+225Q, | |
0x1.3d20e33d8e45a1a90176d17f47edp+231Q, | |
0x1.0b93bfbbf00ac066993c40c364bp+237Q, | |
0x1.cbe5f18b04927ab0575f8f4fd50ep+242Q, | |
0x1.92693359a4002b5a4c739d65da6cp+248Q, | |
0x1.6665b1bbd610269c6c16f82eb688p+254Q, | |
0x1.44cc291239fea2fdc1f4d0ea556bp+260Q, | |
0x1.2b6c35dccd76be41eecdb09806bfp+266Q, | |
0x1.18b5727f009f525dcfe0d58e8653p+272Q, | |
0x1.0b8cf1210c97da816a224b8bd807p+278Q, | |
0x1.0330899804331bad5ed1392f7947p+284Q, | |
0x1.fe478ee348449e7d52abe89576c4p+289Q, | |
0x1.fe478ee348449e7d52abe89576c4p+295Q, | |
0x1.0320568f6ab2d87ba3fb4c1be65p+302Q, | |
0x1.0b395943e6086f3f811b267cc582p+308Q, | |
0x1.17c0097314d0d4767b286c4a9ec4p+314Q, | |
0x1.293c0a0a461de1bde2daf30f48bp+320Q, | |
0x1.4074bad313983760b8940e0c7a5ep+326Q, | |
0x1.5e7fac56dd6e7c91c9e1ef5da5d7p+332Q, | |
0x1.84d5a3305da69231bbf6a58be3fbp+338Q, | |
0x1.b5705796695b6477f3757a3d607ap+344Q, | |
0x1.f2f423e7902c3e98d1b1ff6e020bp+350Q, | |
0x1.207524c1df599430593ae7ab992ep+357Q, | |
0x1.5209471331bcf9a8a891077d1782p+363Q, | |
0x1.916b0466cb106878482c38e48beap+369Q, | |
0x1.e2f4c14bac4fbdb0b6d53472f856p+375Q, | |
0x1.264d25ca1d009797af69ebf60f54p+382Q, | |
0x1.6b473aa57bccbb1f3c86bf43baecp+388Q, | |
0x1.c619094edabfe9e70ba86f14a9a7p+394Q, | |
0x1.1f5bd7e3e66d72043560964b135cp+401Q, | |
0x1.702dac9bff3c3a156463c09030cep+407Q, | |
0x1.dd7b3bda4f021b53be315dbaff4bp+413Q, | |
0x1.3958df4743d961eef4d06582b789p+420Q, | |
0x1.a02a088aa61cb6115d24c6d19bc2p+426Q, | |
0x1.179c3dbd279b4a53aa94b594d4a6p+433Q, | |
0x1.7c1863ed21d71909bbe226d65112p+439Q, | |
0x1.0550c4b30743e136b12b7ab357bcp+446Q, | |
0x1.6b645188f61a65300e6076a16601p+452Q, | |
0x1.ff0512a89a151e4b9437a6d2f771p+458Q, | |
0x1.6b4d9b43dd8b0389bb5f9099fbeap+465Q, | |
0x1.051fc798c73bea8afeacafeead1p+472Q, | |
0x1.7b722e0a018310d1fa12efa6d37bp+478Q, | |
0x1.16a7d9cf591c405a33a5e7fe834ep+485Q, | |
0x1.9da1274fc845ef85e4aa445dcae8p+491Q, | |
0x1.3638dd7bd63473a46b7fb346582ep+498Q, | |
0x1.d62e2fafb0a77f4532ed8bb69da6p+504Q, | |
0x1.67fb5c8283403d70fafddef7d0b3p+511Q, | |
0x1.166c698cf183af8562205a73ab6ap+518Q, | |
0x1.b30964ec395dc24069528d54bbd6p+524Q, | |
0x1.574569a26543fb46d31b2384dc37p+531Q, | |
0x1.118b502d68b22c3c7039a04ddf7cp+538Q, | |
0x1.b83c3509147ebf31449cbdfd53acp+544Q, | |
0x1.65b0eb1760a6fb5807bf5a5dd3fcp+551Q, | |
0x1.256b20d92d48fa2e365af820f7e5p+558Q, | |
0x1.e5f96e67b300de5c8a06aaf69a93p+564Q, | |
0x1.963e824aafa2b9e15b6192ea2537p+571Q, | |
0x1.56c4bdef04314cd6251a53f58f66p+578Q, | |
0x1.23e389bd8991fb6e5b986b7f1c1dp+585Q, | |
0x1.f5af14bdc472e825ad6df8c27852p+591Q, | |
0x1.b30dd3fc905ba550ac655db8a457p+598Q, | |
0x1.7cac197cfe5030a696d8b2018fccp+605Q, | |
0x1.500fee805882caf3112b4d2560f2p+612Q, | |
0x1.2b4e306a4ed47cc07b4a90b54a58p+619Q, | |
0x1.0ce83f7f82d2e814eec4fe02e0cbp+626Q, | |
0x1.e764f3171d1e44a5f0c50c65377p+632Q, | |
0x1.bd824633209daabfae141d5484acp+639Q, | |
0x1.9ab418b722115968b47a8b09ea4fp+646Q, | |
0x1.7dd36efa41ac211f57c9ed4337d5p+653Q, | |
0x1.65f6380a9d915f0d624d4e6f0458p+660Q, | |
0x1.5262c0fa08f36bdaa6ed1424f21bp+667Q, | |
0x1.42861fee508802cc6719f73336c2p+674Q, | |
0x1.35ece2af0162b2b06b12f38b369ep+681Q, | |
0x1.2c3d7b9989579d1ae7ba5beedce9p+688Q, | |
0x1.25340ab3f01f8f6c464bfdc743bcp+695Q, | |
0x1.209f3a89205f112e9532cdd026adp+702Q, | |
0x1.1e5dfc140e1e530c38086834866p+709Q, | |
0x1.1e5dfc140e1e530c38086834866p+716Q, | |
0x1.209ab80c363a8fb250787904ef6dp+723Q, | |
0x1.251d22ec671379f119ba5ae9032bp+730Q, | |
0x1.2bfbd1bdf17deeccc054b90a793ep+737Q, | |
0x1.355bb04be109de4326575ed2cd08p+744Q, | |
0x1.4171452ed7d440f1c5d6c887090ap+751Q, | |
0x1.5082946d09f233fd1b1cd9ed5d76p+758Q, | |
0x1.62e9b88b007d72d4f2986dd85892p+765Q, | |
0x1.79185413b0854a0241c1f4b5de1bp+772Q, | |
0x1.939c09fd12eea9366a6197eaa7b9p+779Q, | |
0x1.b3243ac4d8694e6eaab137c8fcd3p+786Q, | |
0x1.d88957d1c3025b2c2d5c7294428dp+793Q, | |
0x1.026b1c06b6a549dc28ce8ea91465p+801Q, | |
0x1.1ca9fcdf6532135c84f389264077p+808Q, | |
0x1.3bcc9487d4438d7aa37e2c266f84p+815Q, | |
0x1.60ce8defbf23780f02a6f552f095p+822Q, | |
0x1.8ce85fadb707e710e2fbd3fd4ea8p+829Q, | |
0x1.c19f3c62c956f3c121214624f31ap+836Q, | |
0x1.006cd07056d3970424e4fa0112a5p+844Q, | |
0x1.267cf76103b6ff6ec25ef71d3b69p+851Q, | |
0x1.54807e082c4b975810bdcdb9ccb1p+858Q, | |
0x1.8c5d92b5838ffe2c837cf17a4846p+865Q, | |
0x1.d07da7ecb62cbddc2a166afb4cb2p+872Q, | |
0x1.11fa1e0c9f7463fcdcd3391a3a3dp+880Q, | |
0x1.455903aefd5a36bc463ad3cf2528p+887Q, | |
0x1.84e466672ad5d56d0bf2512d9a6ap+894Q, | |
0x1.d3e2cb341f8944c7325f89aaddc8p+901Q, | |
0x1.1b4a51088f181ca49b7fd85a7448p+909Q, | |
0x1.594292c26e6562e89d83cfae3db8p+916Q, | |
0x1.a77ba8027b685b515133acbbb7b4p+923Q, | |
0x1.055e51b1882a685c301de49bdb61p+931Q, | |
0x1.44ab297a8724ada283c521f99a82p+938Q, | |
0x1.95d5f3d928edd90b24b66a780122p+945Q, | |
0x1.fe771cb7257b2b00042d71eaf16dp+952Q, | |
0x1.4307602be5b7f13602a4c216acc7p+960Q, | |
0x1.9b5b6477e6883d2ac75dcf28e005p+967Q, | |
0x1.07868c5ccfaf472f67b818b62f83p+975Q, | |
0x1.53b370efa3b7f1c31bb34fdad93fp+982Q, | |
0x1.b88cb676c8528d8907ec8b8fd1bep+989Q, | |
0x1.1f63cb077cadda54642b4f0ad1d3p+997Q, | |
0x1.7932fa79d3a42e8ec378d7be3365p+1004Q, | |
0x1.f2054eb4d96ec5787e158cd91fdbp+1011Q | |
}; | |
#endif | |
#endif // FACTORIAL_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment