j1l.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. /* j1l.c
  2. *
  3. * Bessel function of order one
  4. *
  5. *
  6. *
  7. * SYNOPSIS:
  8. *
  9. * long double x, y, j1l();
  10. *
  11. * y = j1l( x );
  12. *
  13. *
  14. *
  15. * DESCRIPTION:
  16. *
  17. * Returns Bessel function of order one of the argument.
  18. *
  19. * The domain is divided into the intervals [0, 9] and
  20. * (9, infinity). In the first interval the rational approximation
  21. * is (x^2 - r^2) (x^2 - s^2) (x^2 - t^2) x P8(x^2) / Q8(x^2),
  22. * where r, s, t are the first three zeros of the function.
  23. * In the second interval the expansion is in terms of the
  24. * modulus M1(x) = sqrt(J1(x)^2 + Y1(x)^2) and phase P1(x)
  25. * = atan(Y1(x)/J1(x)). M1 is approximated by sqrt(1/x)P7(1/x)/Q8(1/x).
  26. * The approximation to j1 is M1 * cos(x - 3 pi/4 + 1/x P5(1/x^2)/Q6(1/x^2)).
  27. *
  28. *
  29. * ACCURACY:
  30. *
  31. * Absolute error:
  32. * arithmetic domain # trials peak rms
  33. * IEEE 0, 30 40000 1.8e-19 5.0e-20
  34. *
  35. *
  36. */
  37. /* y1l.c
  38. *
  39. * Bessel function of the second kind, order zero
  40. *
  41. *
  42. *
  43. * SYNOPSIS:
  44. *
  45. * double x, y, y1l();
  46. *
  47. * y = y1l( x );
  48. *
  49. *
  50. *
  51. * DESCRIPTION:
  52. *
  53. * Returns Bessel function of the second kind, of order
  54. * zero, of the argument.
  55. *
  56. * The domain is divided into the intervals [0, 4.5>, [4.5,9> and
  57. * [9, infinity). In the first interval a rational approximation
  58. * R(x) is employed to compute y0(x) = R(x) + 2/pi * log(x) * j0(x).
  59. *
  60. * In the second interval, the approximation is
  61. * (x - p)(x - q)(x - r)(x - s)P9(x)/Q10(x)
  62. * where p, q, r, s are zeros of y1(x).
  63. *
  64. * The third interval uses the same approximations to modulus
  65. * and phase as j1(x), whence y1(x) = modulus * sin(phase).
  66. *
  67. * ACCURACY:
  68. *
  69. * Absolute error, when y0(x) < 1; else relative error:
  70. *
  71. * arithmetic domain # trials peak rms
  72. * IEEE 0, 30 36000 2.7e-19 5.3e-20
  73. *
  74. */
  75. /* Copyright 1994 by Stephen L. Moshier (moshier@world.std.com). */
  76. #include <math.h>
  77. /*
  78. j1(x) = (x^2-r0^2)(x^2-r1^2)(x^2-r2^2) x P(x**2)/Q(x**2)
  79. 0 <= x <= 9
  80. Relative error
  81. n=8, d=8
  82. Peak error = 2e-21
  83. */
  84. #if UNK
  85. static long double j1n[9] = {
  86. -2.63469779622127762897E-4L,
  87. 9.31329762279632791262E-1L,
  88. -1.46280142797793933909E3L,
  89. 1.32000129539331214495E6L,
  90. -7.41183271195454042842E8L,
  91. 2.626500686552841932403E11L,
  92. -5.68263073022183470933E13L,
  93. 6.80006297997263446982E15L,
  94. -3.41470097444474566748E17L,
  95. };
  96. static long double j1d[8] = {
  97. /* 1.00000000000000000000E0L,*/
  98. 2.95267951972943745733E3L,
  99. 4.78723926343829674773E6L,
  100. 5.37544732957807543920E9L,
  101. 4.46866213886267829490E12L,
  102. 2.76959756375961607085E15L,
  103. 1.23367806884831151194E18L,
  104. 3.57325874689695599524E20L,
  105. 5.10779045516141578461E22L,
  106. };
  107. #endif
  108. #if IBMPC
  109. static short j1n[] = {
  110. 0xf72f,0x18cc,0x50b2,0x8a22,0xbff3, XPD
  111. 0x6dc3,0xc850,0xa096,0xee6b,0x3ffe, XPD
  112. 0x29f3,0x496b,0xa54c,0xb6d9,0xc009, XPD
  113. 0x38f5,0xf72b,0x0a5c,0xa122,0x4013, XPD
  114. 0x1ac8,0xc825,0x3c9c,0xb0b6,0xc01c, XPD
  115. 0x038e,0xbd23,0xa7fa,0xf49c,0x4024, XPD
  116. 0x636c,0x4d29,0x9f71,0xcebb,0xc02c, XPD
  117. 0xd3c2,0xf8f0,0xf852,0xc144,0x4033, XPD
  118. 0xd8d8,0x7311,0xa7d2,0x97a4,0xc039, XPD
  119. };
  120. static short j1d[] = {
  121. /*0x0000,0x0000,0x0000,0x8000,0x3fff, XPD*/
  122. 0xbaf9,0x146e,0xdf50,0xb88a,0x400a, XPD
  123. 0x6a17,0xe162,0x4e86,0x9218,0x4015, XPD
  124. 0x6041,0xc9fe,0x6890,0xa033,0x401f, XPD
  125. 0xb498,0xfdd5,0x209e,0x820e,0x4029, XPD
  126. 0x0122,0x56c0,0xf2ef,0x9d6e,0x4032, XPD
  127. 0xe6c0,0xa725,0x3d56,0x88f7,0x403b, XPD
  128. 0x665d,0xb178,0x242e,0x9af7,0x4043, XPD
  129. 0xdd67,0xf5b3,0x0522,0xad0f,0x404a, XPD
  130. };
  131. #endif
  132. #if MIEEE
  133. static long j1n[27] = {
  134. 0xbff30000,0x8a2250b2,0x18ccf72f,
  135. 0x3ffe0000,0xee6ba096,0xc8506dc3,
  136. 0xc0090000,0xb6d9a54c,0x496b29f3,
  137. 0x40130000,0xa1220a5c,0xf72b38f5,
  138. 0xc01c0000,0xb0b63c9c,0xc8251ac8,
  139. 0x40240000,0xf49ca7fa,0xbd23038e,
  140. 0xc02c0000,0xcebb9f71,0x4d29636c,
  141. 0x40330000,0xc144f852,0xf8f0d3c2,
  142. 0xc0390000,0x97a4a7d2,0x7311d8d8,
  143. };
  144. static long j1d[24] = {
  145. /*0x3fff0000,0x80000000,0x00000000,*/
  146. 0x400a0000,0xb88adf50,0x146ebaf9,
  147. 0x40150000,0x92184e86,0xe1626a17,
  148. 0x401f0000,0xa0336890,0xc9fe6041,
  149. 0x40290000,0x820e209e,0xfdd5b498,
  150. 0x40320000,0x9d6ef2ef,0x56c00122,
  151. 0x403b0000,0x88f73d56,0xa725e6c0,
  152. 0x40430000,0x9af7242e,0xb178665d,
  153. 0x404a0000,0xad0f0522,0xf5b3dd67,
  154. };
  155. #endif
  156. /*
  157. sqrt(j0^2(1/x^2) + y0^2(1/x^2)) = z P(z**2)/Q(z**2)
  158. z(x) = 1/sqrt(x)
  159. Relative error
  160. n=7, d=8
  161. Peak error = 1.35e=20
  162. Relative error spread = 9.9e0
  163. */
  164. #if UNK
  165. static long double modulusn[8] = {
  166. -5.041742205078442098874E0L,
  167. 3.918474430130242177355E-1L,
  168. 2.527521168680500659056E0L,
  169. 7.172146812845906480743E0L,
  170. 2.859499532295180940060E0L,
  171. 1.014671139779858141347E0L,
  172. 1.255798064266130869132E-1L,
  173. 1.596507617085714650238E-2L,
  174. };
  175. static long double modulusd[8] = {
  176. /* 1.000000000000000000000E0L,*/
  177. -6.233092094568239317498E0L,
  178. -9.214128701852838347002E-1L,
  179. 2.531772200570435289832E0L,
  180. 8.755081357265851765640E0L,
  181. 3.554340386955608261463E0L,
  182. 1.267949948774331531237E0L,
  183. 1.573909467558180942219E-1L,
  184. 2.000925566825407466160E-2L,
  185. };
  186. #endif
  187. #if IBMPC
  188. static short modulusn[] = {
  189. 0x3d53,0xb598,0xf3bf,0xa155,0xc001, XPD
  190. 0x3111,0x863a,0x3a61,0xc8a0,0x3ffd, XPD
  191. 0x7d55,0xdb8c,0xe825,0xa1c2,0x4000, XPD
  192. 0xe5e2,0x6914,0x3a08,0xe582,0x4001, XPD
  193. 0x71e6,0x88a5,0x0a53,0xb702,0x4000, XPD
  194. 0x2cb0,0xc657,0xbe70,0x81e0,0x3fff, XPD
  195. 0x6de4,0x8fae,0xfe26,0x8097,0x3ffc, XPD
  196. 0xa905,0x05fb,0x3101,0x82c9,0x3ff9, XPD
  197. };
  198. static short modulusd[] = {
  199. /*0x0000,0x0000,0x0000,0x8000,0x3fff, XPD*/
  200. 0x2603,0x640e,0x7d8d,0xc775,0xc001, XPD
  201. 0x77b5,0x8f2d,0xb6bf,0xebe1,0xbffe, XPD
  202. 0x6420,0x97ce,0x8e44,0xa208,0x4000, XPD
  203. 0x0260,0x746b,0xd030,0x8c14,0x4002, XPD
  204. 0x77b6,0x34e2,0x501a,0xe37a,0x4000, XPD
  205. 0x37ce,0x79ae,0x2f15,0xa24c,0x3fff, XPD
  206. 0xfc82,0x02c7,0x17a4,0xa12b,0x3ffc, XPD
  207. 0x1237,0xcc6c,0x7356,0xa3ea,0x3ff9, XPD
  208. };
  209. #endif
  210. #if MIEEE
  211. static long modulusn[24] = {
  212. 0xc0010000,0xa155f3bf,0xb5983d53,
  213. 0x3ffd0000,0xc8a03a61,0x863a3111,
  214. 0x40000000,0xa1c2e825,0xdb8c7d55,
  215. 0x40010000,0xe5823a08,0x6914e5e2,
  216. 0x40000000,0xb7020a53,0x88a571e6,
  217. 0x3fff0000,0x81e0be70,0xc6572cb0,
  218. 0x3ffc0000,0x8097fe26,0x8fae6de4,
  219. 0x3ff90000,0x82c93101,0x05fba905,
  220. };
  221. static long modulusd[24] = {
  222. /*0x3fff0000,0x80000000,0x00000000,*/
  223. 0xc0010000,0xc7757d8d,0x640e2603,
  224. 0xbffe0000,0xebe1b6bf,0x8f2d77b5,
  225. 0x40000000,0xa2088e44,0x97ce6420,
  226. 0x40020000,0x8c14d030,0x746b0260,
  227. 0x40000000,0xe37a501a,0x34e277b6,
  228. 0x3fff0000,0xa24c2f15,0x79ae37ce,
  229. 0x3ffc0000,0xa12b17a4,0x02c7fc82,
  230. 0x3ff90000,0xa3ea7356,0xcc6c1237,
  231. };
  232. #endif
  233. /*
  234. atan(y1(x)/j1(x)) = x - 3pi/4 + z P(z**2)/Q(z**2)
  235. z(x) = 1/x
  236. Absolute error
  237. n=5, d=6
  238. Peak error = 4.83e-21
  239. Relative error spread = 1.9e0
  240. */
  241. #if UNK
  242. static long double phasen[6] = {
  243. 2.010456367705144783933E0L,
  244. 1.587378144541918176658E0L,
  245. 2.682837461073751055565E-1L,
  246. 1.472572645054468815027E-2L,
  247. 2.884976126715926258586E-4L,
  248. 1.708502235134706284899E-6L,
  249. };
  250. static long double phased[6] = {
  251. /* 1.000000000000000000000E0L,*/
  252. 6.809332495854873089362E0L,
  253. 4.518597941618813112665E0L,
  254. 7.320149039410806471101E-1L,
  255. 3.960155028960712309814E-2L,
  256. 7.713202197319040439861E-4L,
  257. 4.556005960359216767984E-6L,
  258. };
  259. #endif
  260. #if IBMPC
  261. static short phasen[] = {
  262. 0xebc0,0x5506,0x512f,0x80ab,0x4000, XPD
  263. 0x6050,0x98aa,0x3500,0xcb2f,0x3fff, XPD
  264. 0xe907,0x28b9,0x7cb7,0x895c,0x3ffd, XPD
  265. 0xa830,0xf4a3,0x2c60,0xf144,0x3ff8, XPD
  266. 0xf74f,0xbe87,0x7e7d,0x9741,0x3ff3, XPD
  267. 0x540c,0xc1d5,0xb096,0xe54f,0x3feb, XPD
  268. };
  269. static short phased[] = {
  270. /*0x0000,0x0000,0x0000,0x8000,0x3fff, XPD*/
  271. 0xefe3,0x292c,0x0d43,0xd9e6,0x4001, XPD
  272. 0xb1f2,0xe0d2,0x5ab5,0x9098,0x4001, XPD
  273. 0xc39e,0x9c8c,0x5428,0xbb65,0x3ffe, XPD
  274. 0x98f8,0xd610,0x3c35,0xa235,0x3ffa, XPD
  275. 0xa853,0x55fb,0x6c79,0xca32,0x3ff4, XPD
  276. 0x8d72,0x2be3,0xcb0f,0x98df,0x3fed, XPD
  277. };
  278. #endif
  279. #if MIEEE
  280. static long phasen[18] = {
  281. 0x40000000,0x80ab512f,0x5506ebc0,
  282. 0x3fff0000,0xcb2f3500,0x98aa6050,
  283. 0x3ffd0000,0x895c7cb7,0x28b9e907,
  284. 0x3ff80000,0xf1442c60,0xf4a3a830,
  285. 0x3ff30000,0x97417e7d,0xbe87f74f,
  286. 0x3feb0000,0xe54fb096,0xc1d5540c,
  287. };
  288. static long phased[18] = {
  289. /*0x3fff0000,0x80000000,0x00000000,*/
  290. 0x40010000,0xd9e60d43,0x292cefe3,
  291. 0x40010000,0x90985ab5,0xe0d2b1f2,
  292. 0x3ffe0000,0xbb655428,0x9c8cc39e,
  293. 0x3ffa0000,0xa2353c35,0xd61098f8,
  294. 0x3ff40000,0xca326c79,0x55fba853,
  295. 0x3fed0000,0x98dfcb0f,0x2be38d72,
  296. };
  297. #endif
  298. #define JZ1 1.46819706421238932572e1L
  299. #define JZ2 4.92184563216946036703e1L
  300. #define JZ3 1.03499453895136580332e2L
  301. #define THPIO4L 2.35619449019234492885L
  302. #ifdef ANSIPROT
  303. extern long double sqrtl ( long double );
  304. extern long double fabsl ( long double );
  305. extern long double polevll ( long double, void *, int );
  306. extern long double p1evll ( long double, void *, int );
  307. extern long double cosl ( long double );
  308. extern long double sinl ( long double );
  309. extern long double logl ( long double );
  310. long double j1l (long double );
  311. #else
  312. long double sqrtl(), fabsl(), polevll(), p1evll(), cosl(), sinl(), logl();
  313. long double j1l();
  314. #endif
  315. long double j1l(x)
  316. long double x;
  317. {
  318. long double xx, y, z, modulus, phase;
  319. xx = x * x;
  320. if( xx < 81.0L )
  321. {
  322. y = (xx - JZ1) * (xx - JZ2) * (xx - JZ3);
  323. y *= x * polevll( xx, j1n, 8 ) / p1evll( xx, j1d, 8 );
  324. return y;
  325. }
  326. y = fabsl(x);
  327. xx = 1.0/xx;
  328. phase = polevll( xx, phasen, 5 ) / p1evll( xx, phased, 6 );
  329. z = 1.0/y;
  330. modulus = polevll( z, modulusn, 7 ) / p1evll( z, modulusd, 8 );
  331. y = modulus * cosl( y - THPIO4L + z*phase) / sqrtl(y);
  332. if( x < 0 )
  333. y = -y;
  334. return y;
  335. }
  336. /*
  337. y1(x) = 2/pi * (log(x) * j1(x) - 1/x) + R(x^2) z P(z**2)/Q(z**2)
  338. 0 <= x <= 4.5
  339. z(x) = x
  340. Absolute error
  341. n=6, d=7
  342. Peak error = 7.25e-22
  343. Relative error spread = 4.5e-2
  344. */
  345. #if UNK
  346. static long double y1n[7] = {
  347. -1.288901054372751879531E5L,
  348. 9.914315981558815369372E7L,
  349. -2.906793378120403577274E10L,
  350. 3.954354656937677136266E12L,
  351. -2.445982226888344140154E14L,
  352. 5.685362960165615942886E15L,
  353. -2.158855258453711703120E16L,
  354. };
  355. static long double y1d[7] = {
  356. /* 1.000000000000000000000E0L,*/
  357. 8.926354644853231136073E2L,
  358. 4.679841933793707979659E5L,
  359. 1.775133253792677466651E8L,
  360. 5.089532584184822833416E10L,
  361. 1.076474894829072923244E13L,
  362. 1.525917240904692387994E15L,
  363. 1.101136026928555260168E17L,
  364. };
  365. #endif
  366. #if IBMPC
  367. static short y1n[] = {
  368. 0x5b16,0xf7f8,0x0d7e,0xfbbd,0xc00f, XPD
  369. 0x53e4,0x194c,0xbefa,0xbd19,0x4019, XPD
  370. 0x7607,0xa687,0xaf0a,0xd892,0xc021, XPD
  371. 0x5633,0xaa6b,0x79e5,0xe62c,0x4028, XPD
  372. 0x69fd,0x1242,0xf62d,0xde75,0xc02e, XPD
  373. 0x7f8b,0x4757,0x75bd,0xa196,0x4033, XPD
  374. 0x3a10,0x0848,0x5930,0x9965,0xc035, XPD
  375. };
  376. static short y1d[] = {
  377. /*0x0000,0x0000,0x0000,0x8000,0x3fff, XPD*/
  378. 0xdd1a,0x3b8e,0xab73,0xdf28,0x4008, XPD
  379. 0x298c,0x29ef,0x0630,0xe482,0x4011, XPD
  380. 0x0e86,0x117b,0x36d6,0xa94a,0x401a, XPD
  381. 0x57e0,0x1d92,0x90a9,0xbd99,0x4022, XPD
  382. 0xaaf0,0x342b,0xd098,0x9ca5,0x402a, XPD
  383. 0x8c6a,0x397e,0x0963,0xad7a,0x4031, XPD
  384. 0x7302,0xb91b,0xde7e,0xc399,0x4037, XPD
  385. };
  386. #endif
  387. #if MIEEE
  388. static long y1n[21] = {
  389. 0xc00f0000,0xfbbd0d7e,0xf7f85b16,
  390. 0x40190000,0xbd19befa,0x194c53e4,
  391. 0xc0210000,0xd892af0a,0xa6877607,
  392. 0x40280000,0xe62c79e5,0xaa6b5633,
  393. 0xc02e0000,0xde75f62d,0x124269fd,
  394. 0x40330000,0xa19675bd,0x47577f8b,
  395. 0xc0350000,0x99655930,0x08483a10,
  396. };
  397. static long y1d[21] = {
  398. /*0x3fff0000,0x80000000,0x00000000,*/
  399. 0x40080000,0xdf28ab73,0x3b8edd1a,
  400. 0x40110000,0xe4820630,0x29ef298c,
  401. 0x401a0000,0xa94a36d6,0x117b0e86,
  402. 0x40220000,0xbd9990a9,0x1d9257e0,
  403. 0x402a0000,0x9ca5d098,0x342baaf0,
  404. 0x40310000,0xad7a0963,0x397e8c6a,
  405. 0x40370000,0xc399de7e,0xb91b7302,
  406. };
  407. #endif
  408. /*
  409. y1(x) = (x-YZ1)(x-YZ2)(x-YZ3)(x-YZ4)R(x) P(z)/Q(z)
  410. z(x) = x
  411. 4.5 <= x <= 9
  412. Absolute error
  413. n=9, d=10
  414. Peak error = 3.27e-22
  415. Relative error spread = 4.5e-2
  416. */
  417. #if UNK
  418. static long double y159n[10] = {
  419. -6.806634906054210550896E-1L,
  420. 4.306669585790359450532E1L,
  421. -9.230477746767243316014E2L,
  422. 6.171186628598134035237E3L,
  423. 2.096869860275353982829E4L,
  424. -1.238961670382216747944E5L,
  425. -1.781314136808997406109E6L,
  426. -1.803400156074242435454E6L,
  427. -1.155761550219364178627E6L,
  428. 3.112221202330688509818E5L,
  429. };
  430. static long double y159d[10] = {
  431. /* 1.000000000000000000000E0L,*/
  432. -6.181482377814679766978E1L,
  433. 2.238187927382180589099E3L,
  434. -5.225317824142187494326E4L,
  435. 9.217235006983512475118E5L,
  436. -1.183757638771741974521E7L,
  437. 1.208072488974110742912E8L,
  438. -8.193431077523942651173E8L,
  439. 4.282669747880013349981E9L,
  440. -1.171523459555524458808E9L,
  441. 1.078445545755236785692E8L,
  442. };
  443. #endif
  444. #if IBMPC
  445. static short y159n[] = {
  446. 0xb5e5,0xbb42,0xf667,0xae3f,0xbffe, XPD
  447. 0xfdf1,0x41e5,0x4beb,0xac44,0x4004, XPD
  448. 0xe917,0x8486,0x0ebd,0xe6c3,0xc008, XPD
  449. 0xdf40,0x226b,0x7e37,0xc0d9,0x400b, XPD
  450. 0xb2bf,0x4296,0x65af,0xa3d1,0x400d, XPD
  451. 0xa33b,0x8229,0x1561,0xf1fc,0xc00f, XPD
  452. 0xcd43,0x2f50,0x1118,0xd972,0xc013, XPD
  453. 0x3811,0xa3da,0x413f,0xdc24,0xc013, XPD
  454. 0xf62f,0xd968,0x8c66,0x8d15,0xc013, XPD
  455. 0x539b,0xf305,0xc3d8,0x97f6,0x4011, XPD
  456. };
  457. static short y159d[] = {
  458. /*0x0000,0x0000,0x0000,0x8000,0x3fff, XPD*/
  459. 0x1a6c,0x1c93,0x612a,0xf742,0xc004, XPD
  460. 0xd0fe,0x2487,0x01c0,0x8be3,0x400a, XPD
  461. 0xbed4,0x3ad5,0x2da1,0xcc1d,0xc00e, XPD
  462. 0x3c4f,0xdc46,0xb802,0xe107,0x4012, XPD
  463. 0xe5e5,0x4172,0x8863,0xb4a0,0xc016, XPD
  464. 0x6de5,0xb797,0xea1c,0xe66b,0x4019, XPD
  465. 0xa46a,0x0273,0xbc0f,0xc358,0xc01c, XPD
  466. 0x8e0e,0xe148,0x5ab3,0xff44,0x401e, XPD
  467. 0xb3ad,0x1c6d,0x0f07,0x8ba8,0xc01d, XPD
  468. 0xa231,0x6ab0,0x7952,0xcdb2,0x4019, XPD
  469. };
  470. #endif
  471. #if MIEEE
  472. static long y159n[30] = {
  473. 0xbffe0000,0xae3ff667,0xbb42b5e5,
  474. 0x40040000,0xac444beb,0x41e5fdf1,
  475. 0xc0080000,0xe6c30ebd,0x8486e917,
  476. 0x400b0000,0xc0d97e37,0x226bdf40,
  477. 0x400d0000,0xa3d165af,0x4296b2bf,
  478. 0xc00f0000,0xf1fc1561,0x8229a33b,
  479. 0xc0130000,0xd9721118,0x2f50cd43,
  480. 0xc0130000,0xdc24413f,0xa3da3811,
  481. 0xc0130000,0x8d158c66,0xd968f62f,
  482. 0x40110000,0x97f6c3d8,0xf305539b,
  483. };
  484. static long y159d[30] = {
  485. /*0x3fff0000,0x80000000,0x00000000,*/
  486. 0xc0040000,0xf742612a,0x1c931a6c,
  487. 0x400a0000,0x8be301c0,0x2487d0fe,
  488. 0xc00e0000,0xcc1d2da1,0x3ad5bed4,
  489. 0x40120000,0xe107b802,0xdc463c4f,
  490. 0xc0160000,0xb4a08863,0x4172e5e5,
  491. 0x40190000,0xe66bea1c,0xb7976de5,
  492. 0xc01c0000,0xc358bc0f,0x0273a46a,
  493. 0x401e0000,0xff445ab3,0xe1488e0e,
  494. 0xc01d0000,0x8ba80f07,0x1c6db3ad,
  495. 0x40190000,0xcdb27952,0x6ab0a231,
  496. };
  497. #endif
  498. extern long double MAXNUML;
  499. /* #define MAXNUML 1.18973149535723176502e4932L */
  500. #define TWOOPI 6.36619772367581343075535e-1L
  501. #define THPIO4 2.35619449019234492885L
  502. #define Y1Z1 2.19714132603101703515e0L
  503. #define Y1Z2 5.42968104079413513277e0L
  504. #define Y1Z3 8.59600586833116892643e0L
  505. #define Y1Z4 1.17491548308398812434e1L
  506. long double y1l(x)
  507. long double x;
  508. {
  509. long double xx, y, z, modulus, phase;
  510. if( x < 0.0 )
  511. {
  512. return (-MAXNUML);
  513. }
  514. z = 1.0/x;
  515. xx = x * x;
  516. if( xx < 81.0L )
  517. {
  518. if( xx < 20.25L )
  519. {
  520. y = TWOOPI * (logl(x) * j1l(x) - z);
  521. y += x * polevll( xx, y1n, 6 ) / p1evll( xx, y1d, 7 );
  522. }
  523. else
  524. {
  525. y = (x - Y1Z1)*(x - Y1Z2)*(x - Y1Z3)*(x - Y1Z4);
  526. y *= polevll( x, y159n, 9 ) / p1evll( x, y159d, 10 );
  527. }
  528. return y;
  529. }
  530. xx = 1.0/xx;
  531. phase = polevll( xx, phasen, 5 ) / p1evll( xx, phased, 6 );
  532. modulus = polevll( z, modulusn, 7 ) / p1evll( z, modulusd, 8 );
  533. z = modulus * sinl( x - THPIO4L + z*phase) / sqrtl(x);
  534. return z;
  535. }