dbsk0e.cpp 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /* dbsk0e.f -- translated by f2c (version 20100827).
  2. This file no longer depends on f2c.
  3. */
  4. #include "slatec-internal.hpp"
  5. /* Table of constant values */
  6. static integer const c__3 = 3;
  7. static integer const c__16 = 16;
  8. static integer const c__38 = 38;
  9. static integer const c__33 = 33;
  10. static integer const c__2 = 2;
  11. /* Initialized data */
  12. static double const bk0cs[16] = { -.0353273932339027687201140060063153,
  13. .344289899924628486886344927529213,
  14. .0359799365153615016265721303687231,
  15. .00126461541144692592338479508673447,
  16. 2.28621210311945178608269830297585e-5,
  17. 2.53479107902614945730790013428354e-7,
  18. 1.90451637722020885897214059381366e-9,
  19. 1.03496952576336245851008317853089e-11,
  20. 4.25981614279108257652445327170133e-14,
  21. 1.3744654358807508969423832544e-16,
  22. 3.57089652850837359099688597333333e-19,
  23. 7.63164366011643737667498666666666e-22,
  24. 1.36542498844078185908053333333333e-24,
  25. 2.07527526690666808319999999999999e-27,
  26. 2.7128142180729856e-30,
  27. 3.08259388791466666666666666666666e-33 };
  28. static double const ak0cs[38] = { -.07643947903327941424082978270088,
  29. -.02235652605699819052023095550791,
  30. 7.734181154693858235300618174047e-4,
  31. -4.281006688886099464452146435416e-5,
  32. 3.08170017386297474365001482666e-6,
  33. -2.639367222009664974067448892723e-7,
  34. 2.563713036403469206294088265742e-8,
  35. -2.742705549900201263857211915244e-9,
  36. 3.169429658097499592080832873403e-10,
  37. -3.902353286962184141601065717962e-11,
  38. 5.068040698188575402050092127286e-12,
  39. -6.889574741007870679541713557984e-13,
  40. 9.744978497825917691388201336831e-14,
  41. -1.427332841884548505389855340122e-14,
  42. 2.156412571021463039558062976527e-15,
  43. -3.34965425514956277218878205853e-16,
  44. 5.335260216952911692145280392601e-17,
  45. -8.693669980890753807639622378837e-18,
  46. 1.446404347862212227887763442346e-18,
  47. -2.452889825500129682404678751573e-19,
  48. 4.2337545262321715728217063424e-20,
  49. -7.427946526454464195695341294933e-21,
  50. 1.3231505293926668662779674624e-21,
  51. -2.390587164739649451335981465599e-22,
  52. 4.376827585923226140165712554666e-23,
  53. -8.113700607345118059339011413333e-24,
  54. 1.521819913832172958310378154666e-24,
  55. -2.886041941483397770235958613333e-25,
  56. 5.530620667054717979992610133333e-26,
  57. -1.070377329249898728591633066666e-26,
  58. 2.091086893142384300296328533333e-27,
  59. -4.121713723646203827410261333333e-28,
  60. 8.19348397112130764013568e-29,
  61. -1.642000275459297726780757333333e-29,
  62. 3.316143281480227195890346666666e-30,
  63. -6.746863644145295941085866666666e-31,
  64. 1.382429146318424677635413333333e-31,
  65. -2.851874167359832570811733333333e-32 };
  66. static double const ak02cs[33] = { -.01201869826307592239839346212452,
  67. -.009174852691025695310652561075713,
  68. 1.444550931775005821048843878057e-4,
  69. -4.013614175435709728671021077879e-6,
  70. 1.567831810852310672590348990333e-7,
  71. -7.77011043852173771031579975446e-9,
  72. 4.611182576179717882533130529586e-10,
  73. -3.158592997860565770526665803309e-11,
  74. 2.435018039365041127835887814329e-12,
  75. -2.074331387398347897709853373506e-13,
  76. 1.925787280589917084742736504693e-14,
  77. -1.927554805838956103600347182218e-15,
  78. 2.062198029197818278285237869644e-16,
  79. -2.341685117579242402603640195071e-17,
  80. 2.805902810643042246815178828458e-18,
  81. -3.530507631161807945815482463573e-19,
  82. 4.645295422935108267424216337066e-20,
  83. -6.368625941344266473922053461333e-21,
  84. 9.0695213109865155676223488e-22,
  85. -1.337974785423690739845005311999e-22,
  86. 2.03983602185995231552208896e-23,
  87. -3.207027481367840500060869973333e-24,
  88. 5.189744413662309963626359466666e-25,
  89. -8.629501497540572192964607999999e-26,
  90. 1.4721611831025598552080384e-26,
  91. -2.573069023867011283812351999999e-27,
  92. 4.60177408664351658737664e-28,
  93. -8.411555324201093737130666666666e-29,
  94. 1.569806306635368939301546666666e-29,
  95. -2.988226453005757788979199999999e-30,
  96. 5.796831375216836520618666666666e-31,
  97. -1.145035994347681332155733333333e-31,
  98. 2.301266594249682802005333333333e-32 };
  99. static float const eta = (float) d1mach_(3) * (float).1;
  100. static integer const ntk0 = initds_(bk0cs, &c__16, &eta);
  101. static integer const ntak0 = initds_(ak0cs, &c__38, &eta);
  102. static integer const ntak02 = initds_(ak02cs, &c__33, &eta);
  103. static double const xsml = sqrt(d1mach_(3) * 4.);
  104. double dbsk0e_(double const *x)
  105. {
  106. /* System generated locals */
  107. double d__1;
  108. /* Local variables */
  109. double y;
  110. /* ***BEGIN PROLOGUE DBSK0E */
  111. /* ***PURPOSE Compute the exponentially scaled modified (hyperbolic) */
  112. /* Bessel function of the third kind of order zero. */
  113. /* ***LIBRARY SLATEC (FNLIB) */
  114. /* ***CATEGORY C10B1 */
  115. /* ***TYPE DOUBLE PRECISION (BESK0E-S, DBSK0E-D) */
  116. /* ***KEYWORDS EXPONENTIALLY SCALED, FNLIB, HYPERBOLIC BESSEL FUNCTION, */
  117. /* MODIFIED BESSEL FUNCTION, ORDER ZERO, SPECIAL FUNCTIONS, */
  118. /* THIRD KIND */
  119. /* ***AUTHOR Fullerton, W., (LANL) */
  120. /* ***DESCRIPTION */
  121. /* DBSK0E(X) computes the double precision exponentially scaled */
  122. /* modified (hyperbolic) Bessel function of the third kind of */
  123. /* order zero for positive double precision argument X. */
  124. /* Series for BK0 on the interval 0. to 4.00000E+00 */
  125. /* with weighted error 3.08E-33 */
  126. /* log weighted error 32.51 */
  127. /* significant figures required 32.05 */
  128. /* decimal places required 33.11 */
  129. /* Series for AK0 on the interval 1.25000E-01 to 5.00000E-01 */
  130. /* with weighted error 2.85E-32 */
  131. /* log weighted error 31.54 */
  132. /* significant figures required 30.19 */
  133. /* decimal places required 32.33 */
  134. /* Series for AK02 on the interval 0. to 1.25000E-01 */
  135. /* with weighted error 2.30E-32 */
  136. /* log weighted error 31.64 */
  137. /* significant figures required 29.68 */
  138. /* decimal places required 32.40 */
  139. /* ***REFERENCES (NONE) */
  140. /* ***ROUTINES CALLED D1MACH, DBESI0, DCSEVL, INITDS, XERMSG */
  141. /* ***REVISION HISTORY (YYMMDD) */
  142. /* 770701 DATE WRITTEN */
  143. /* 890531 Changed all specific intrinsics to generic. (WRB) */
  144. /* 890531 REVISION DATE from Version 3.2 */
  145. /* 891214 Prologue converted to Version 4.0 format. (BAB) */
  146. /* 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ) */
  147. /* ***END PROLOGUE DBSK0E */
  148. /* ***FIRST EXECUTABLE STATEMENT DBSK0E */
  149. if (*x <= 0.) {
  150. xermsg_("SLATEC", "DBSK0E", "X IS ZERO OR NEGATIVE", &c__2, &c__2, (ftnlen)6, (ftnlen)6, (ftnlen)21);
  151. }
  152. if (*x > 2.) {
  153. if (*x <= 8.) {
  154. d__1 = (16. / *x - 5.) / 3.;
  155. return (dcsevl_(&d__1, ak0cs, &ntak0) + 1.25) / sqrt(*x);
  156. } else {
  157. d__1 = 16. / *x - 1.;
  158. return (dcsevl_(&d__1, ak02cs, &ntak02) + 1.25) / sqrt(*x);
  159. }
  160. } else {
  161. y = 0.;
  162. if (*x > xsml) {
  163. y = *x * *x;
  164. }
  165. d__1 = y * .5 - 1.;
  166. return exp(*x) * (-log(*x * .5) * dbesi0_(x) - .25 + dcsevl_(&d__1, bk0cs, &ntk0));
  167. }
  168. } /* dbsk0e_ */