📄 sici.c
字号:
#ifdef IBMPCstatic unsigned short FN8[] = {0x5d2f,0xf89b,0x2d26,0x3fdd,0x4e48,0x6a1d,0xd6c1,0x3fe6,0xe2ec,0x308d,0x84b7,0x3fc4,0x79a4,0xb7a2,0xc51b,0x3f87,0x1226,0x7d09,0xe895,0x3f36,0xac1a,0xccab,0x64b2,0x3ed4,0x1ae1,0x6209,0x2f52,0x3e61,0x0304,0x425e,0xe32f,0x3dd9,0x7a9d,0xa12e,0x513d,0x3d3b,};static unsigned short FD8[] = {/*0x0000,0x0000,0x0000,0x3ff0,*/0x8f72,0xa608,0x5bdc,0x3fed,0x0e46,0xfebc,0xdf2a,0x3fc6,0x5bad,0xf917,0x099b,0x3f89,0xe36f,0xa8ab,0x81ed,0x3f37,0xa5a8,0x32a6,0xa77b,0x3ed4,0x660a,0x4631,0x48f1,0x3e61,0x9a40,0xe12e,0xf0d7,0x3dd9,0x7a9d,0xa12e,0x513d,0x3d3b,};#endif#ifdef MIEEEstatic unsigned short FN8[] = {0x3fdd,0x2d26,0xf89b,0x5d2f,0x3fe6,0xd6c1,0x6a1d,0x4e48,0x3fc4,0x84b7,0x308d,0xe2ec,0x3f87,0xc51b,0xb7a2,0x79a4,0x3f36,0xe895,0x7d09,0x1226,0x3ed4,0x64b2,0xccab,0xac1a,0x3e61,0x2f52,0x6209,0x1ae1,0x3dd9,0xe32f,0x425e,0x0304,0x3d3b,0x513d,0xa12e,0x7a9d,};static unsigned short FD8[] = {/*0x3ff0,0x0000,0x0000,0x0000,*/0x3fed,0x5bdc,0xa608,0x8f72,0x3fc6,0xdf2a,0xfebc,0x0e46,0x3f89,0x099b,0xf917,0x5bad,0x3f37,0x81ed,0xa8ab,0xe36f,0x3ed4,0xa77b,0x32a6,0xa5a8,0x3e61,0x48f1,0x4631,0x660a,0x3dd9,0xf0d7,0xe12e,0x9a40,0x3d3b,0x513d,0xa12e,0x7a9d,};#endif#ifdef UNKstatic double GN4[] = { 8.71001698973114191777E-2, 6.11379109952219284151E-1, 3.97180296392337498885E-1, 7.48527737628469092119E-2, 5.38868681462177273157E-3, 1.61999794598934024525E-4, 1.97963874140963632189E-6, 7.82579040744090311069E-9,};static double GD4[] = {/* 1.00000000000000000000E0,*/ 1.64402202413355338886E0, 6.66296701268987968381E-1, 9.88771761277688796203E-2, 6.22396345441768420760E-3, 1.73221081474177119497E-4, 2.02659182086343991969E-6, 7.82579218933534490868E-9,};#endif#ifdef DECstatic unsigned short GN4[] = {0037262,0060622,0164572,0157515,0040034,0101527,0061263,0147204,0037713,0055467,0037475,0144512,0037231,0046151,0035234,0045261,0036260,0111624,0150617,0053536,0035051,0157175,0016675,0155456,0033404,0154757,0041211,0000055,0031406,0071060,0130322,0033322,};static unsigned short GD4[] = {/* 0040200,0000000,0000000,0000000,*/0040322,0067520,0046707,0053275,0040052,0111153,0126542,0005516,0037312,0100035,0167121,0014552,0036313,0171143,0137176,0014213,0035065,0121256,0012033,0150603,0033410,0000225,0013121,0071643,0031406,0071062,0131152,0150454,};#endif#ifdef IBMPCstatic unsigned short GN4[] = {0x5bea,0x5d2f,0x4c32,0x3fb6,0x79d1,0xec56,0x906a,0x3fe3,0xb929,0xe7e7,0x6b66,0x3fd9,0x8956,0x2753,0x298d,0x3fb3,0xeaec,0x9a31,0x1272,0x3f76,0xbb66,0xa3b7,0x3bcf,0x3f25,0x2006,0xe851,0x9b3d,0x3ec0,0x46da,0x161a,0xce46,0x3e40,};static unsigned short GD4[] = {/* 0x0000,0x0000,0x0000,0x3ff0,*/0xead8,0x09b8,0x4dea,0x3ffa,0x416a,0x75ac,0x524d,0x3fe5,0x232d,0xbdca,0x5003,0x3fb9,0xc311,0x77cf,0x7e4c,0x3f79,0x7a30,0xc283,0xb455,0x3f26,0x2e74,0xa2ca,0x0012,0x3ec1,0x5a26,0x564d,0xce46,0x3e40,};#endif#ifdef MIEEEstatic unsigned short GN4[] = {0x3fb6,0x4c32,0x5d2f,0x5bea,0x3fe3,0x906a,0xec56,0x79d1,0x3fd9,0x6b66,0xe7e7,0xb929,0x3fb3,0x298d,0x2753,0x8956,0x3f76,0x1272,0x9a31,0xeaec,0x3f25,0x3bcf,0xa3b7,0xbb66,0x3ec0,0x9b3d,0xe851,0x2006,0x3e40,0xce46,0x161a,0x46da,};static unsigned short GD4[] = {/*0x3ff0,0x0000,0x0000,0x0000,*/0x3ffa,0x4dea,0x09b8,0xead8,0x3fe5,0x524d,0x75ac,0x416a,0x3fb9,0x5003,0xbdca,0x232d,0x3f79,0x7e4c,0x77cf,0xc311,0x3f26,0xb455,0xc283,0x7a30,0x3ec1,0x0012,0xa2ca,0x2e74,0x3e40,0xce46,0x564d,0x5a26,};#endif#ifdef UNKstatic double GN8[] = { 6.97359953443276214934E-1, 3.30410979305632063225E-1, 3.84878767649974295920E-2, 1.71718239052347903558E-3, 3.48941165502279436777E-5, 3.47131167084116673800E-7, 1.70404452782044526189E-9, 3.85945925430276600453E-12, 3.14040098946363334640E-15,};static double GD8[] = {/* 1.00000000000000000000E0,*/ 1.68548898811011640017E0, 4.87852258695304967486E-1, 4.67913194259625806320E-2, 1.90284426674399523638E-3, 3.68475504442561108162E-5, 3.57043223443740838771E-7, 1.72693748966316146736E-9, 3.87830166023954706752E-12, 3.14040098946363335242E-15,};#endif#ifdef DECstatic unsigned short GN8[] = {0040062,0103056,0110624,0033123,0037651,0025640,0136266,0145647,0037035,0122566,0137770,0061777,0035741,0011424,0065311,0013370,0034422,0055505,0134324,0016755,0032672,0056530,0022565,0014747,0030752,0031674,0114735,0013162,0026607,0145353,0022020,0123625,0024142,0045054,0060033,0016505,};static unsigned short GD8[] = {/*0040200,0000000,0000000,0000000,*/0040327,0137032,0064331,0136425,0037771,0143705,0070300,0105711,0037077,0124101,0025275,0035356,0035771,0064333,0145103,0105357,0034432,0106301,0105311,0010713,0032677,0127645,0120034,0157551,0030755,0054466,0010743,0105566,0026610,0072242,0142530,0135744,0024142,0045054,0060033,0016505,};#endif#ifdef IBMPCstatic unsigned short GN8[] = {0x86ca,0xd232,0x50c5,0x3fe6,0xd975,0x1796,0x2574,0x3fd5,0x0c80,0xd7ff,0xb4ae,0x3fa3,0x22df,0x8d59,0x2262,0x3f5c,0x83be,0xb71a,0x4b68,0x3f02,0xa33d,0x04ae,0x4bab,0x3e97,0xa2ce,0x933b,0x4677,0x3e1d,0x14f3,0x6482,0xf95d,0x3d90,0x63a9,0x8c03,0x4945,0x3cec,};static unsigned short GD8[] = {/*0x0000,0x0000,0x0000,0x3ff0,*/0x37a3,0x4d1b,0xf7c3,0x3ffa,0x1179,0xae18,0x38f8,0x3fdf,0xa75e,0x2557,0xf508,0x3fa7,0x715e,0x7948,0x2d1b,0x3f5f,0x2239,0x3159,0x5198,0x3f03,0x9bed,0xb403,0xf5f4,0x3e97,0x716f,0xc23c,0xab26,0x3e1d,0x177c,0x58ab,0x0e94,0x3d91,0x63a9,0x8c03,0x4945,0x3cec,};#endif#ifdef MIEEEstatic unsigned short GN8[] = {0x3fe6,0x50c5,0xd232,0x86ca,0x3fd5,0x2574,0x1796,0xd975,0x3fa3,0xb4ae,0xd7ff,0x0c80,0x3f5c,0x2262,0x8d59,0x22df,0x3f02,0x4b68,0xb71a,0x83be,0x3e97,0x4bab,0x04ae,0xa33d,0x3e1d,0x4677,0x933b,0xa2ce,0x3d90,0xf95d,0x6482,0x14f3,0x3cec,0x4945,0x8c03,0x63a9,};static unsigned short GD8[] = {/*0x3ff0,0x0000,0x0000,0x0000,*/0x3ffa,0xf7c3,0x4d1b,0x37a3,0x3fdf,0x38f8,0xae18,0x1179,0x3fa7,0xf508,0x2557,0xa75e,0x3f5f,0x2d1b,0x7948,0x715e,0x3f03,0x5198,0x3159,0x2239,0x3e97,0xf5f4,0xb403,0x9bed,0x3e1d,0xab26,0xc23c,0x716f,0x3d91,0x0e94,0x58ab,0x177c,0x3cec,0x4945,0x8c03,0x63a9,};#endif#ifdef ANSIPROTextern double log ( double );extern double sin ( double );extern double cos ( double );extern double polevl ( double, void *, int );extern double p1evl ( double, void *, int );#elsedouble log(), sin(), cos(), polevl(), p1evl();#endif#define EUL 0.57721566490153286061extern double MAXNUM, PIO2, MACHEP;int sici( x, si, ci )double x;double *si, *ci;{double z, c, s, f, g;short sign;if( x < 0.0 ) { sign = -1; x = -x; }else sign = 0;if( x == 0.0 ) { *si = 0.0; *ci = -MAXNUM; return( 0 ); }if( x > 1.0e9 ) { *si = PIO2 - cos(x)/x; *ci = sin(x)/x; return( 0 ); }if( x > 4.0 ) goto asympt;z = x * x;s = x * polevl( z, SN, 5 ) / polevl( z, SD, 5 );c = z * polevl( z, CN, 5 ) / polevl( z, CD, 5 );if( sign ) s = -s;*si = s;*ci = EUL + log(x) + c; /* real part if x < 0 */return(0);/* The auxiliary functions are: * * * *si = *si - PIO2; * c = cos(x); * s = sin(x); * * t = *ci * s - *si * c; * a = *ci * c + *si * s; * * *si = t; * *ci = -a; */asympt:s = sin(x);c = cos(x);z = 1.0/(x*x);if( x < 8.0 ) { f = polevl( z, FN4, 6 ) / (x * p1evl( z, FD4, 7 )); g = z * polevl( z, GN4, 7 ) / p1evl( z, GD4, 7 ); }else { f = polevl( z, FN8, 8 ) / (x * p1evl( z, FD8, 8 )); g = z * polevl( z, GN8, 8 ) / p1evl( z, GD8, 9 ); }*si = PIO2 - f * c - g * s;if( sign ) *si = -( *si );*ci = f * s - g * c;return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -