📄 ei.c
字号:
0xbfd1,0x9cbd,0x38a2,0x3643,0x3fa4,0x203f,0x4ad3,0xc0b3,0xbf6b,0xf91c,0xd02b,0xdacc,0x3f28,0x7817,0x1a91,0x3d92,0xbeda,0x9d0c,0x797e,0x644d,0x3e80,0xa3c3,0x675b,0x657c,0xbe12,0xa89c,0xfba3,0x2fcb,};#endif/* 16 <= x <= 32 x exp(-x) Ei(x) - 1 = 1/x A4(1/x) / B4(1/x) Theoretical absolute error = 1.22e-17 */#if UNKstatic double A4[8] = {-2.458119367674020323359E-1,-1.483382253322077687183E-1, 7.248291795735551591813E-2,-1.348315687380940523823E-2, 1.342775069788636972294E-3,-7.942465637159712264564E-5, 2.644179518984235952241E-6,-4.239473659313765177195E-8,};static double B4[8] = { /* 1.000000000000000000000E0, */-1.044225908443871106315E-1,-2.676453128101402655055E-1, 9.695000254621984627876E-2,-1.601745692712991078208E-2, 1.496414899205908021882E-3,-8.462452563778485013756E-5, 2.728938403476726394024E-6,-4.239462431819542051337E-8,};#endif#if DECstatic short A4[32] = {0137573,0133037,0152607,0113356,0137427,0162771,0145061,0126345,0037224,0070754,0110451,0174104,0136534,0164165,0072170,0063753,0035660,0000016,0002560,0147751,0134646,0110311,0123316,0047432,0033461,0071250,0101031,0075202,0132066,0012601,0077305,0170177,};static short B4[32] = { /* 0040200,0000000,0000000,0000000, */0137325,0155602,0162437,0030710,0137611,0004316,0071344,0176361,0037306,0106671,0011103,0155053,0136603,0033412,0132530,0175171,0035704,0021532,0015516,0166130,0134661,0074162,0036741,0073466,0033467,0021316,0003100,0171325,0132066,0012541,0162202,0150160,};#endif#if IBMPCstatic short A4[] = {0xf2de,0xfab0,0x76c3,0xbfcf,0x359d,0x3946,0xfcbf,0xbfc2,0x3f09,0x9225,0x8e3d,0x3fb2,0x0cfd,0xae8f,0x9d0e,0xbf8b,0x19fd,0xc0ae,0x0001,0x3f56,0xc9e3,0x34d9,0xd219,0xbf14,0x2f50,0x1043,0x2e55,0x3ec6,0xbe10,0x2fd8,0xc2b0,0xbe66,};static short B4[] = { /* 0x0000,0x0000,0x0000,0x3ff0, */0xe639,0x5ca3,0xbb70,0xbfba,0x9f9e,0xce5c,0x2119,0xbfd1,0x7b45,0x2248,0xd1b7,0x3fb8,0x1f4f,0x56ab,0x66e1,0xbf90,0xdd8b,0x4369,0x846b,0x3f58,0x2ee7,0x47bc,0x2f0e,0xbf16,0x1e5b,0xc0c8,0xe459,0x3ec6,0x5a0e,0x3c90,0xc2ac,0xbe66,};#endif#if MIEEEstatic short A4[32] = {0xbfcf,0x76c3,0xfab0,0xf2de,0xbfc2,0xfcbf,0x3946,0x359d,0x3fb2,0x8e3d,0x9225,0x3f09,0xbf8b,0x9d0e,0xae8f,0x0cfd,0x3f56,0x0001,0xc0ae,0x19fd,0xbf14,0xd219,0x34d9,0xc9e3,0x3ec6,0x2e55,0x1043,0x2f50,0xbe66,0xc2b0,0x2fd8,0xbe10,};static short B4[32] = { /* 0x3ff0,0x0000,0x0000,0x0000, */0xbfba,0xbb70,0x5ca3,0xe639,0xbfd1,0x2119,0xce5c,0x9f9e,0x3fb8,0xd1b7,0x2248,0x7b45,0xbf90,0x66e1,0x56ab,0x1f4f,0x3f58,0x846b,0x4369,0xdd8b,0xbf16,0x2f0e,0x47bc,0x2ee7,0x3ec6,0xe459,0xc0c8,0x1e5b,0xbe66,0xc2ac,0x3c90,0x5a0e,};#endif#if 0/* 20 <= x <= 40 x exp(-x) Ei(x) - 1 = 1/x A4(1/x) / B4(1/x) Theoretical absolute error = 1.78e-17 */#if UNKstatic double A4[8] = { 2.067245813525780707978E-1,-5.153749551345223645670E-1, 1.928289589546695033096E-1,-3.124468842857260044075E-2, 2.740283734277352539912E-3,-1.377775664366875175601E-4, 3.803788980664744242323E-6,-4.611038277393688031154E-8,};static double B4[8] = { /* 1.000000000000000000000E0, */-8.544436025219516861531E-1, 2.507436807692907385181E-1,-3.647688090228423114064E-2, 3.008576950332041388892E-3,-1.452926405348421286334E-4, 3.896007735260115431965E-6,-4.611037642697098234083E-8,};#endif#if DECstatic short A4[32] = {0037523,0127633,0150301,0022031,0140003,0167634,0170572,0170420,0037505,0072364,0060672,0063220,0136777,0172334,0057456,0102640,0036063,0113125,0002476,0047251,0135020,0074142,0042600,0043630,0033577,0042230,0155372,0136105,0132106,0005346,0165333,0114541,};static short B4[28] = { /* 0040200,0000000,0000000,0000000, */0140132,0136320,0160433,0131535,0037600,0060571,0144452,0060214,0137025,0064310,0024220,0176472,0036105,0025613,0115762,0166605,0135030,0054662,0035454,0061763,0033602,0135163,0116430,0000066,0132106,0005345,0020602,0137133,};#endif#if IBMPCstatic short A4[32] = {0x2483,0x7a18,0x75f3,0x3fca,0x5e22,0x9e2f,0x7df3,0xbfe0,0x4cd2,0x8c37,0xae9e,0x3fc8,0xd0b4,0x8be5,0xfe9b,0xbf9f,0xc9d5,0xa0a7,0x72ca,0x3f66,0x08f3,0x48b0,0x0f0c,0xbf22,0x5789,0x1b5f,0xe893,0x3ecf,0x732c,0xdd5b,0xc15c,0xbe68,};static short B4[28] = { /* 0x0000,0x0000,0x0000,0x3ff0, */0x766c,0x1c23,0x579a,0xbfeb,0x4c11,0x3925,0x0c2f,0x3fd0,0x1fa7,0x0512,0xad19,0xbfa2,0x5db1,0x737e,0xa571,0x3f68,0x8c7e,0x4765,0x0b36,0xbf23,0x0007,0x73a3,0x574e,0x3ed0,0x57cb,0xa430,0xc15c,0xbe68,};#endif#if MIEEEstatic short A4[32] = {0x3fca,0x75f3,0x7a18,0x2483,0xbfe0,0x7df3,0x9e2f,0x5e22,0x3fc8,0xae9e,0x8c37,0x4cd2,0xbf9f,0xfe9b,0x8be5,0xd0b4,0x3f66,0x72ca,0xa0a7,0xc9d5,0xbf22,0x0f0c,0x48b0,0x08f3,0x3ecf,0xe893,0x1b5f,0x5789,0xbe68,0xc15c,0xdd5b,0x732c,};static short B4[28] = { /* 0x3ff0,0x0000,0x0000,0x0000, */0xbfeb,0x579a,0x1c23,0x766c,0x3fd0,0x0c2f,0x3925,0x4c11,0xbfa2,0xad19,0x0512,0x1fa7,0x3f68,0xa571,0x737e,0x5db1,0xbf23,0x0b36,0x4765,0x8c7e,0x3ed0,0x574e,0x73a3,0x0007,0xbe68,0xc15c,0xa430,0x57cb,};#endif#endif /* 0 *//* 4 <= x <= 8 x exp(-x) Ei(x) - 1 = 1/x A5(1/x) / B5(1/x) Theoretical absolute error = 2.20e-17 */#if UNKstatic double A5[8] = {-1.373215375871208729803E0,-7.084559133740838761406E-1, 1.580806855547941010501E0,-2.601500427425622944234E-1, 2.994674694113713763365E-2,-1.038086040188744005513E-3, 4.371064420753005429514E-5, 2.141783679522602903795E-6,};static double B5[8] = { /* 1.000000000000000000000E0, */ 8.585231423622028380768E-1, 4.483285822873995129957E-1, 7.687932158124475434091E-2, 2.449868241021887685904E-2, 8.832165941927796567926E-4, 4.590952299511353531215E-4,-4.729848351866523044863E-6, 2.665195537390710170105E-6,};#endif#if DECstatic short A5[32] = {0140257,0142605,0076335,0113632,0140065,0056535,0161231,0074311,0040312,0053741,0004357,0076405,0137605,0031142,0165503,0136705,0036765,0051341,0053573,0007602,0135610,0010143,0027643,0110522,0034467,0052762,0062024,0120161,0033417,0135620,0036500,0062647,};static short B[32] = { /* 0040200,0000000,0000000,0000000, */0040133,0144054,0031516,0004100,0037745,0105522,0166622,0123146,0037235,0071347,0157560,0157464,0036710,0130565,0173747,0041670,0035547,0103651,0106243,0101240,0035360,0131267,0176263,0140257,0133636,0132426,0102537,0102531,0033462,0155665,0167503,0176350,};#endif#if IBMPCstatic short A5[32] = {0xb2f3,0xaf9b,0xf8b0,0xbff5,0x2f19,0xbc53,0xabab,0xbfe6,0xefa1,0x211d,0x4afc,0x3ff9,0x77b9,0x5d68,0xa64c,0xbfd0,0x61f0,0x2aef,0xaa5c,0x3f9e,0x722a,0x65f4,0x020c,0xbf51,0x940e,0x4c82,0xeabe,0x3f06,0x0cb5,0x07a8,0xf772,0x3ec1,};static short B5[32] = { /* 0x0000,0x0000,0x0000,0x3ff0, */0xc108,0x8669,0x7905,0x3feb,0x54cd,0x5db2,0xb16a,0x3fdc,0x1be7,0xfbee,0xae5c,0x3fb3,0xe877,0xbefc,0x162e,0x3f99,0x7054,0x3194,0xf0f5,0x3f4c,0x7816,0xff96,0x1656,0x3f3e,0xf0ab,0xd0ab,0xd6a2,0xbed3,0x7f9d,0xbde8,0x5b76,0x3ec6,};#endif#if MIEEEstatic short A5[32] = {0xbff5,0xf8b0,0xaf9b,0xb2f3,0xbfe6,0xabab,0xbc53,0x2f19,0x3ff9,0x4afc,0x211d,0xefa1,0xbfd0,0xa64c,0x5d68,0x77b9,0x3f9e,0xaa5c,0x2aef,0x61f0,0xbf51,0x020c,0x65f4,0x722a,0x3f06,0xeabe,0x4c82,0x940e,0x3ec1,0xf772,0x07a8,0x0cb5,};static short B5[32] = { /* 0x3ff0,0x0000,0x0000,0x0000, */0x3feb,0x7905,0x8669,0xc108,0x3fdc,0xb16a,0x5db2,0x54cd,0x3fb3,0xae5c,0xfbee,0x1be7,0x3f99,0x162e,0xbefc,0xe877,0x3f4c,0xf0f5,0x3194,0x7054,0x3f3e,0x1656,0xff96,0x7816,0xbed3,0xd6a2,0xd0ab,0xf0ab,0x3ec6,0x5b76,0xbde8,0x7f9d,};#endif/* 2 <= x <= 4 x exp(-x) Ei(x) - 1 = 1/x A6(1/x) / B6(1/x) Theoretical absolute error = 4.89e-17 */#if UNKstatic double A6[8] = { 1.981808503259689673238E-2,-1.271645625984917501326E0,-2.088160335681228318920E0, 2.755544509187936721172E0,-4.409507048701600257171E-1, 4.665623805935891391017E-2,-1.545042679673485262580E-3, 7.059980605299617478514E-5,};static double B6[7] = { /* 1.000000000000000000000E0, */ 1.476498670914921440652E0, 5.629177174822436244827E-1, 1.699017897879307263248E-1, 2.291647179034212017463E-2, 4.450150439728752875043E-3, 1.727439612206521482874E-4, 3.953167195549672482304E-5,};#endif#if DECstatic short A6[32] = {0036642,0054611,0061263,0000140,0140242,0142510,0125732,0072035,0140405,0122153,0037643,0104527,0040460,0055327,0055550,0116240,0137741,0142112,0070441,0103510,0037077,0015234,0104750,0146765,0135712,0101407,0107554,0020253,0034624,0007373,0072621,0063735,};static short B6[28] = { /* 0040200,0000000,0000000,0000000, */0040274,0176750,0110025,0061006,0040020,0015540,0021354,0155050,0037455,0175274,0015257,0021112,0036673,0135523,0016042,0117203,0036221,0151221,0046352,0144174,0035065,0021232,0117727,0152432,0034445,0147317,0037300,0067123,};#endif#if IBMPCstatic short A6[32] = {0x600c,0x2c56,0x4b31,0x3f94,0x4e84,0x157b,0x58a9,0xbff4,0x712b,0x67f4,0xb48d,0xc000,0x1394,0xeb6d,0x0b5a,0x4006,0x30e9,0x4e24,0x3889,0xbfdc,0x19bf,0x913d,0xe353,0x3fa7,0x8415,0xf1ed,0x5060,0xbf59,0x2cfc,0x6eb2,0x81df,0x3f12,};static short B6[28] = { /* 0x0000,0x0000,0x0000,0x3ff0, */0xac41,0x1202,0x9fbd,0x3ff7,0x9b45,0x045d,0x036c,0x3fe2,0xe449,0x8355,0xbf57,0x3fc5,0x53d0,0x6384,0x776a,0x3f97,0x590f,0x299d,0x3a52,0x3f72,0xfaa3,0x53fa,0xa453,0x3f26,0x0dca,0xe7d8,0xb9d9,0x3f04,};#endif#if MIEEEstatic short A6[32] = {0x3f94,0x4b31,0x2c56,0x600c,0xbff4,0x58a9,0x157b,0x4e84,0xc000,0xb48d,0x67f4,0x712b,0x4006,0x0b5a,0xeb6d,0x1394,0xbfdc,0x3889,0x4e24,0x30e9,0x3fa7,0xe353,0x913d,0x19bf,0xbf59,0x5060,0xf1ed,0x8415,0x3f12,0x81df,0x6eb2,0x2cfc,};static short B6[28] = { /* 0x3ff0,0x0000,0x0000,0x0000, */0x3ff7,0x9fbd,0x1202,0xac41,0x3fe2,0x036c,0x045d,0x9b45,0x3fc5,0xbf57,0x8355,0xe449,0x3f97,0x776a,0x6384,0x53d0,0x3f72,0x3a52,0x299d,0x590f,0x3f26,0xa453,0x53fa,0xfaa3,0x3f04,0xb9d9,0xe7d8,0x0dca,};#endif/* 32 <= x <= 64 x exp(-x) Ei(x) - 1 = 1/x A7(1/x) / B7(1/x) Theoretical absolute error = 7.71e-18 */#if UNKstatic double A7[6] = { 1.212561118105456670844E-1,-5.823133179043894485122E-1, 2.348887314557016779211E-1,-3.040034318113248237280E-2, 1.510082146865190661777E-3,-2.523137095499571377122E-5,};static double B7[5] = { /* 1.000000000000000000000E0, */-1.002252150365854016662E0, 2.928709694872224144953E-1,-3.337004338674007801307E-2, 1.560544881127388842819E-3,-2.523137093603234562648E-5,};#endif#if DECstatic short A7[24] = {0037370,0052437,0152524,0150125,0140025,0011174,0050154,0131330,0037560,0103253,0167464,0062245,0136771,0005043,0174001,0023345,0035705,0166762,0157300,0016451,0134323,0123764,0157767,0134477,};static short B7[20] = { /* 0040200,0000000,0000000,0000000, */0140200,0044714,0064025,0060324,0037625,0171457,0003712,0073131,0137010,0127406,0150061,0141746,0035714,0105462,0072356,0103712,0134323,0123764,0156514,0077414,};#endif#if IBMPCstatic short A7[24] = {0x9a0b,0xfaaa,0x0aa3,0x3fbf,0x965b,0x8a0d,0xa24f,0xbfe2,0x8c95,0x7de6,0x10d5,0x3fce,0x24dd,0x7f00,0x2144,0xbf9f,0x03a5,0x5bd8,0xbdbe,0x3f58,0xf728,0x9bfe,0x74fe,0xbefa,};static short B7[20] = { /* 0x0000,0x0000,0x0000,0x3ff0, */0xac1a,0x8d02,0x0939,0xbff0,0x4ecb,0xe0f9,0xbe65,0x3fd2,0x387d,0xda06,0x15e0,0xbfa1,0xd0f9,0x4e9d,0x9166,0x3f59,0x8fe2,0x9ba9,0x74fe,0xbefa,};#endif#if MIEEEstatic short A7[24] = {0x3fbf,0x0aa3,0xfaaa,0x9a0b,0xbfe2,0xa24f,0x8a0d,0x965b,0x3fce,0x10d5,0x7de6,0x8c95,0xbf9f,0x2144,0x7f00,0x24dd,0x3f58,0xbdbe,0x5bd8,0x03a5,0xbefa,0x74fe,0x9bfe,0xf728,};static short B7[20] = { /* 0x3ff0,0x0000,0x0000,0x0000, */0xbff0,0x0939,0x8d02,0xac1a,0x3fd2,0xbe65,0xe0f9,0x4ecb,0xbfa1,0x15e0,0xda06,0x387d,0x3f59,0x9166,0x4e9d,0xd0f9,0xbefa,0x74fe,0x9ba9,0x8fe2,};#endifdouble ei (x)double x;{ double f, w; if (x <= 0.0) { mtherr("ei", DOMAIN); return 0.0; } else if (x < 2.0) { /* Power series. inf n - x Ei(x) = EUL + ln x + > ---- - n n! n=1 */ f = polevl(x,A,5) / p1evl(x,B,6); /* f = polevl(x,A,6) / p1evl(x,B,7); */ /* f = polevl(x,A,8) / p1evl(x,B,9); */ return (EUL + log(x) + x * f); } else if (x < 4.0) { /* Asymptotic expansion. 1 2 6 x exp(-x) Ei(x) = 1 + --- + --- + ---- + ... x 2 3 x x */ w = 1.0/x; f = polevl(w,A6,7) / p1evl(w,B6,7); return (exp(x) * w * (1.0 + w * f)); } else if (x < 8.0) { w = 1.0/x; f = polevl(w,A5,7) / p1evl(w,B5,8); return (exp(x) * w * (1.0 + w * f)); } else if (x < 16.0) { w = 1.0/x; f = polevl(w,A2,9) / p1evl(w,B2,9); return (exp(x) * w * (1.0 + w * f)); } else if (x < 32.0) { w = 1.0/x; f = polevl(w,A4,7) / p1evl(w,B4,8); return (exp(x) * w * (1.0 + w * f)); } else if (x < 64.0) { w = 1.0/x; f = polevl(w,A7,5) / p1evl(w,B7,5); return (exp(x) * w * (1.0 + w * f)); } else { w = 1.0/x; f = polevl(w,A3,8) / p1evl(w,B3,9); return (exp(x) * w * (1.0 + w * f)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -