johnson 2.0.0.pre1 → 2.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. data/CHANGELOG.rdoc +12 -0
  2. data/Manifest.txt +4 -285
  3. data/Rakefile +13 -20
  4. data/ext/tracemonkey/global.cc +4 -1
  5. data/ext/tracemonkey/js.cc +30 -33
  6. data/ext/tracemonkey/runtime.cc +96 -6
  7. data/ext/tracemonkey/split_global.cc +0 -5
  8. data/ext/tracemonkey/tracemonkey.h +2 -2
  9. data/lib/johnson.rb +2 -2
  10. data/lib/johnson/runtime.rb +25 -15
  11. data/lib/johnson/tracemonkey/runtime.rb +6 -3
  12. data/vendor/tracemonkey/config/system-headers +1 -3
  13. data/vendor/tracemonkey/jscntxt.h +5 -2
  14. data/vendor/tracemonkey/jsdbgapi.cpp +9 -1
  15. data/vendor/tracemonkey/jsdbgapi.h +4 -0
  16. data/vendor/tracemonkey/tests/ecma/NativeObjects/browser.js +0 -0
  17. data/vendor/tracemonkey/tests/ecma/NativeObjects/jstests.list +0 -0
  18. data/vendor/tracemonkey/tests/ecma_3_1/Object/jstests.list +1 -1
  19. data/vendor/tracemonkey/tests/js1_3/misc/browser.js +0 -0
  20. data/vendor/tracemonkey/tests/js1_3/misc/jstests.list +0 -0
  21. data/vendor/tracemonkey/tests/js1_5/Regress/jstests.list +4 -4
  22. data/vendor/tracemonkey/tests/js1_5/Scope/jstests.list +1 -1
  23. data/vendor/tracemonkey/tests/js1_5/decompilation/jstests.list +2 -2
  24. data/vendor/tracemonkey/tests/js1_7/decompilation/jstests.list +1 -1
  25. data/vendor/tracemonkey/tests/shell.js +2 -1
  26. metadata +51 -309
  27. data/ext/spidermonkey/context.c +0 -116
  28. data/ext/spidermonkey/context.h +0 -19
  29. data/ext/spidermonkey/conversions.c +0 -361
  30. data/ext/spidermonkey/conversions.h +0 -31
  31. data/ext/spidermonkey/debugger.c +0 -234
  32. data/ext/spidermonkey/debugger.h +0 -10
  33. data/ext/spidermonkey/extconf.rb +0 -32
  34. data/ext/spidermonkey/extensions.c +0 -37
  35. data/ext/spidermonkey/extensions.h +0 -12
  36. data/ext/spidermonkey/global.c +0 -40
  37. data/ext/spidermonkey/global.h +0 -11
  38. data/ext/spidermonkey/idhash.c +0 -16
  39. data/ext/spidermonkey/idhash.h +0 -8
  40. data/ext/spidermonkey/immutable_node.c +0 -1153
  41. data/ext/spidermonkey/immutable_node.c.erb +0 -523
  42. data/ext/spidermonkey/immutable_node.h +0 -22
  43. data/ext/spidermonkey/jroot.h +0 -197
  44. data/ext/spidermonkey/js_land_proxy.c +0 -620
  45. data/ext/spidermonkey/js_land_proxy.h +0 -20
  46. data/ext/spidermonkey/ruby_land_proxy.c +0 -618
  47. data/ext/spidermonkey/ruby_land_proxy.h +0 -38
  48. data/ext/spidermonkey/runtime.c +0 -396
  49. data/ext/spidermonkey/runtime.h +0 -27
  50. data/ext/spidermonkey/spidermonkey.c +0 -22
  51. data/ext/spidermonkey/spidermonkey.h +0 -29
  52. data/lib/johnson/spidermonkey.rb +0 -12
  53. data/lib/johnson/spidermonkey/context.rb +0 -10
  54. data/lib/johnson/spidermonkey/debugger.rb +0 -67
  55. data/lib/johnson/spidermonkey/immutable_node.rb +0 -282
  56. data/lib/johnson/spidermonkey/js_land_proxy.rb +0 -64
  57. data/lib/johnson/spidermonkey/mutable_tree_visitor.rb +0 -242
  58. data/lib/johnson/spidermonkey/ruby_land_proxy.rb +0 -17
  59. data/lib/johnson/spidermonkey/runtime.rb +0 -74
  60. data/test/johnson/spidermonkey/context_test.rb +0 -21
  61. data/test/johnson/spidermonkey/immutable_node_test.rb +0 -34
  62. data/test/johnson/spidermonkey/js_land_proxy_test.rb +0 -273
  63. data/test/johnson/spidermonkey/ruby_land_proxy_test.rb +0 -274
  64. data/test/johnson/spidermonkey/runtime_test.rb +0 -41
  65. data/vendor/spidermonkey/.cvsignore +0 -9
  66. data/vendor/spidermonkey/Makefile.in +0 -449
  67. data/vendor/spidermonkey/Makefile.ref +0 -365
  68. data/vendor/spidermonkey/README.html +0 -820
  69. data/vendor/spidermonkey/SpiderMonkey.rsp +0 -12
  70. data/vendor/spidermonkey/Y.js +0 -19
  71. data/vendor/spidermonkey/build.mk +0 -43
  72. data/vendor/spidermonkey/config.mk +0 -192
  73. data/vendor/spidermonkey/config/AIX4.1.mk +0 -65
  74. data/vendor/spidermonkey/config/AIX4.2.mk +0 -64
  75. data/vendor/spidermonkey/config/AIX4.3.mk +0 -65
  76. data/vendor/spidermonkey/config/Darwin.mk +0 -83
  77. data/vendor/spidermonkey/config/Darwin1.3.mk +0 -81
  78. data/vendor/spidermonkey/config/Darwin1.4.mk +0 -41
  79. data/vendor/spidermonkey/config/Darwin5.2.mk +0 -81
  80. data/vendor/spidermonkey/config/Darwin5.3.mk +0 -81
  81. data/vendor/spidermonkey/config/HP-UXB.10.10.mk +0 -77
  82. data/vendor/spidermonkey/config/HP-UXB.10.20.mk +0 -77
  83. data/vendor/spidermonkey/config/HP-UXB.11.00.mk +0 -80
  84. data/vendor/spidermonkey/config/IRIX.mk +0 -87
  85. data/vendor/spidermonkey/config/IRIX5.3.mk +0 -44
  86. data/vendor/spidermonkey/config/IRIX6.1.mk +0 -44
  87. data/vendor/spidermonkey/config/IRIX6.2.mk +0 -44
  88. data/vendor/spidermonkey/config/IRIX6.3.mk +0 -44
  89. data/vendor/spidermonkey/config/IRIX6.5.mk +0 -44
  90. data/vendor/spidermonkey/config/Linux_All.mk +0 -103
  91. data/vendor/spidermonkey/config/Mac_OS10.0.mk +0 -82
  92. data/vendor/spidermonkey/config/OSF1V4.0.mk +0 -72
  93. data/vendor/spidermonkey/config/OSF1V5.0.mk +0 -69
  94. data/vendor/spidermonkey/config/SunOS4.1.4.mk +0 -101
  95. data/vendor/spidermonkey/config/SunOS5.10.mk +0 -50
  96. data/vendor/spidermonkey/config/SunOS5.3.mk +0 -91
  97. data/vendor/spidermonkey/config/SunOS5.4.mk +0 -92
  98. data/vendor/spidermonkey/config/SunOS5.5.1.mk +0 -44
  99. data/vendor/spidermonkey/config/SunOS5.5.mk +0 -87
  100. data/vendor/spidermonkey/config/SunOS5.6.mk +0 -89
  101. data/vendor/spidermonkey/config/SunOS5.7.mk +0 -44
  102. data/vendor/spidermonkey/config/SunOS5.8.mk +0 -44
  103. data/vendor/spidermonkey/config/SunOS5.9.mk +0 -44
  104. data/vendor/spidermonkey/config/WINNT4.0.mk +0 -117
  105. data/vendor/spidermonkey/config/WINNT5.0.mk +0 -117
  106. data/vendor/spidermonkey/config/WINNT5.1.mk +0 -117
  107. data/vendor/spidermonkey/config/WINNT5.2.mk +0 -117
  108. data/vendor/spidermonkey/config/WINNT6.0.mk +0 -117
  109. data/vendor/spidermonkey/config/dgux.mk +0 -64
  110. data/vendor/spidermonkey/editline/Makefile.ref +0 -144
  111. data/vendor/spidermonkey/editline/README +0 -83
  112. data/vendor/spidermonkey/editline/editline.3 +0 -175
  113. data/vendor/spidermonkey/editline/editline.c +0 -1369
  114. data/vendor/spidermonkey/editline/editline.h +0 -135
  115. data/vendor/spidermonkey/editline/sysunix.c +0 -182
  116. data/vendor/spidermonkey/editline/unix.h +0 -82
  117. data/vendor/spidermonkey/fdlibm/.cvsignore +0 -7
  118. data/vendor/spidermonkey/fdlibm/Makefile.in +0 -127
  119. data/vendor/spidermonkey/fdlibm/Makefile.ref +0 -192
  120. data/vendor/spidermonkey/fdlibm/e_acos.c +0 -147
  121. data/vendor/spidermonkey/fdlibm/e_acosh.c +0 -105
  122. data/vendor/spidermonkey/fdlibm/e_asin.c +0 -156
  123. data/vendor/spidermonkey/fdlibm/e_atan2.c +0 -165
  124. data/vendor/spidermonkey/fdlibm/e_atanh.c +0 -110
  125. data/vendor/spidermonkey/fdlibm/e_cosh.c +0 -133
  126. data/vendor/spidermonkey/fdlibm/e_exp.c +0 -202
  127. data/vendor/spidermonkey/fdlibm/e_fmod.c +0 -184
  128. data/vendor/spidermonkey/fdlibm/e_gamma.c +0 -71
  129. data/vendor/spidermonkey/fdlibm/e_gamma_r.c +0 -70
  130. data/vendor/spidermonkey/fdlibm/e_hypot.c +0 -173
  131. data/vendor/spidermonkey/fdlibm/e_j0.c +0 -524
  132. data/vendor/spidermonkey/fdlibm/e_j1.c +0 -523
  133. data/vendor/spidermonkey/fdlibm/e_jn.c +0 -315
  134. data/vendor/spidermonkey/fdlibm/e_lgamma.c +0 -71
  135. data/vendor/spidermonkey/fdlibm/e_lgamma_r.c +0 -347
  136. data/vendor/spidermonkey/fdlibm/e_log.c +0 -184
  137. data/vendor/spidermonkey/fdlibm/e_log10.c +0 -134
  138. data/vendor/spidermonkey/fdlibm/e_pow.c +0 -386
  139. data/vendor/spidermonkey/fdlibm/e_rem_pio2.c +0 -222
  140. data/vendor/spidermonkey/fdlibm/e_remainder.c +0 -120
  141. data/vendor/spidermonkey/fdlibm/e_scalb.c +0 -89
  142. data/vendor/spidermonkey/fdlibm/e_sinh.c +0 -122
  143. data/vendor/spidermonkey/fdlibm/e_sqrt.c +0 -497
  144. data/vendor/spidermonkey/fdlibm/fdlibm.h +0 -273
  145. data/vendor/spidermonkey/fdlibm/fdlibm.mak +0 -1453
  146. data/vendor/spidermonkey/fdlibm/fdlibm.mdp +0 -0
  147. data/vendor/spidermonkey/fdlibm/k_cos.c +0 -135
  148. data/vendor/spidermonkey/fdlibm/k_rem_pio2.c +0 -354
  149. data/vendor/spidermonkey/fdlibm/k_sin.c +0 -114
  150. data/vendor/spidermonkey/fdlibm/k_standard.c +0 -785
  151. data/vendor/spidermonkey/fdlibm/k_tan.c +0 -170
  152. data/vendor/spidermonkey/fdlibm/s_asinh.c +0 -101
  153. data/vendor/spidermonkey/fdlibm/s_atan.c +0 -175
  154. data/vendor/spidermonkey/fdlibm/s_cbrt.c +0 -133
  155. data/vendor/spidermonkey/fdlibm/s_ceil.c +0 -120
  156. data/vendor/spidermonkey/fdlibm/s_copysign.c +0 -72
  157. data/vendor/spidermonkey/fdlibm/s_cos.c +0 -118
  158. data/vendor/spidermonkey/fdlibm/s_erf.c +0 -356
  159. data/vendor/spidermonkey/fdlibm/s_expm1.c +0 -267
  160. data/vendor/spidermonkey/fdlibm/s_fabs.c +0 -70
  161. data/vendor/spidermonkey/fdlibm/s_finite.c +0 -71
  162. data/vendor/spidermonkey/fdlibm/s_floor.c +0 -121
  163. data/vendor/spidermonkey/fdlibm/s_frexp.c +0 -99
  164. data/vendor/spidermonkey/fdlibm/s_ilogb.c +0 -85
  165. data/vendor/spidermonkey/fdlibm/s_isnan.c +0 -74
  166. data/vendor/spidermonkey/fdlibm/s_ldexp.c +0 -66
  167. data/vendor/spidermonkey/fdlibm/s_lib_version.c +0 -73
  168. data/vendor/spidermonkey/fdlibm/s_log1p.c +0 -211
  169. data/vendor/spidermonkey/fdlibm/s_logb.c +0 -79
  170. data/vendor/spidermonkey/fdlibm/s_matherr.c +0 -64
  171. data/vendor/spidermonkey/fdlibm/s_modf.c +0 -132
  172. data/vendor/spidermonkey/fdlibm/s_nextafter.c +0 -124
  173. data/vendor/spidermonkey/fdlibm/s_rint.c +0 -131
  174. data/vendor/spidermonkey/fdlibm/s_scalbn.c +0 -107
  175. data/vendor/spidermonkey/fdlibm/s_signgam.c +0 -40
  176. data/vendor/spidermonkey/fdlibm/s_significand.c +0 -68
  177. data/vendor/spidermonkey/fdlibm/s_sin.c +0 -118
  178. data/vendor/spidermonkey/fdlibm/s_tan.c +0 -112
  179. data/vendor/spidermonkey/fdlibm/s_tanh.c +0 -122
  180. data/vendor/spidermonkey/fdlibm/w_acos.c +0 -78
  181. data/vendor/spidermonkey/fdlibm/w_acosh.c +0 -78
  182. data/vendor/spidermonkey/fdlibm/w_asin.c +0 -80
  183. data/vendor/spidermonkey/fdlibm/w_atan2.c +0 -79
  184. data/vendor/spidermonkey/fdlibm/w_atanh.c +0 -81
  185. data/vendor/spidermonkey/fdlibm/w_cosh.c +0 -77
  186. data/vendor/spidermonkey/fdlibm/w_exp.c +0 -88
  187. data/vendor/spidermonkey/fdlibm/w_fmod.c +0 -78
  188. data/vendor/spidermonkey/fdlibm/w_gamma.c +0 -85
  189. data/vendor/spidermonkey/fdlibm/w_gamma_r.c +0 -81
  190. data/vendor/spidermonkey/fdlibm/w_hypot.c +0 -78
  191. data/vendor/spidermonkey/fdlibm/w_j0.c +0 -105
  192. data/vendor/spidermonkey/fdlibm/w_j1.c +0 -106
  193. data/vendor/spidermonkey/fdlibm/w_jn.c +0 -128
  194. data/vendor/spidermonkey/fdlibm/w_lgamma.c +0 -85
  195. data/vendor/spidermonkey/fdlibm/w_lgamma_r.c +0 -81
  196. data/vendor/spidermonkey/fdlibm/w_log.c +0 -78
  197. data/vendor/spidermonkey/fdlibm/w_log10.c +0 -81
  198. data/vendor/spidermonkey/fdlibm/w_pow.c +0 -99
  199. data/vendor/spidermonkey/fdlibm/w_remainder.c +0 -77
  200. data/vendor/spidermonkey/fdlibm/w_scalb.c +0 -95
  201. data/vendor/spidermonkey/fdlibm/w_sinh.c +0 -77
  202. data/vendor/spidermonkey/fdlibm/w_sqrt.c +0 -77
  203. data/vendor/spidermonkey/javascript-trace.d +0 -73
  204. data/vendor/spidermonkey/js.c +0 -3951
  205. data/vendor/spidermonkey/js.mdp +0 -0
  206. data/vendor/spidermonkey/js.msg +0 -308
  207. data/vendor/spidermonkey/js.pkg +0 -2
  208. data/vendor/spidermonkey/js3240.rc +0 -79
  209. data/vendor/spidermonkey/jsOS240.def +0 -654
  210. data/vendor/spidermonkey/jsapi.c +0 -5836
  211. data/vendor/spidermonkey/jsapi.h +0 -2624
  212. data/vendor/spidermonkey/jsarena.c +0 -450
  213. data/vendor/spidermonkey/jsarena.h +0 -318
  214. data/vendor/spidermonkey/jsarray.c +0 -2996
  215. data/vendor/spidermonkey/jsarray.h +0 -127
  216. data/vendor/spidermonkey/jsatom.c +0 -1045
  217. data/vendor/spidermonkey/jsatom.h +0 -442
  218. data/vendor/spidermonkey/jsbit.h +0 -253
  219. data/vendor/spidermonkey/jsbool.c +0 -176
  220. data/vendor/spidermonkey/jsbool.h +0 -73
  221. data/vendor/spidermonkey/jsclist.h +0 -139
  222. data/vendor/spidermonkey/jscntxt.c +0 -1348
  223. data/vendor/spidermonkey/jscntxt.h +0 -1120
  224. data/vendor/spidermonkey/jscompat.h +0 -57
  225. data/vendor/spidermonkey/jsconfig.h +0 -248
  226. data/vendor/spidermonkey/jsconfig.mk +0 -181
  227. data/vendor/spidermonkey/jscpucfg.c +0 -396
  228. data/vendor/spidermonkey/jscpucfg.h +0 -212
  229. data/vendor/spidermonkey/jsdate.c +0 -2390
  230. data/vendor/spidermonkey/jsdate.h +0 -124
  231. data/vendor/spidermonkey/jsdbgapi.c +0 -1802
  232. data/vendor/spidermonkey/jsdbgapi.h +0 -464
  233. data/vendor/spidermonkey/jsdhash.c +0 -868
  234. data/vendor/spidermonkey/jsdhash.h +0 -592
  235. data/vendor/spidermonkey/jsdtoa.c +0 -3167
  236. data/vendor/spidermonkey/jsdtoa.h +0 -130
  237. data/vendor/spidermonkey/jsdtracef.c +0 -317
  238. data/vendor/spidermonkey/jsdtracef.h +0 -77
  239. data/vendor/spidermonkey/jsemit.c +0 -6909
  240. data/vendor/spidermonkey/jsemit.h +0 -741
  241. data/vendor/spidermonkey/jsexn.c +0 -1371
  242. data/vendor/spidermonkey/jsexn.h +0 -96
  243. data/vendor/spidermonkey/jsfile.c +0 -2736
  244. data/vendor/spidermonkey/jsfile.h +0 -56
  245. data/vendor/spidermonkey/jsfile.msg +0 -90
  246. data/vendor/spidermonkey/jsfun.c +0 -2634
  247. data/vendor/spidermonkey/jsfun.h +0 -254
  248. data/vendor/spidermonkey/jsgc.c +0 -3562
  249. data/vendor/spidermonkey/jsgc.h +0 -403
  250. data/vendor/spidermonkey/jshash.c +0 -476
  251. data/vendor/spidermonkey/jshash.h +0 -151
  252. data/vendor/spidermonkey/jsify.pl +0 -485
  253. data/vendor/spidermonkey/jsinterp.c +0 -7007
  254. data/vendor/spidermonkey/jsinterp.h +0 -525
  255. data/vendor/spidermonkey/jsinvoke.c +0 -43
  256. data/vendor/spidermonkey/jsiter.c +0 -1067
  257. data/vendor/spidermonkey/jsiter.h +0 -122
  258. data/vendor/spidermonkey/jskeyword.tbl +0 -124
  259. data/vendor/spidermonkey/jskwgen.c +0 -460
  260. data/vendor/spidermonkey/jslibmath.h +0 -266
  261. data/vendor/spidermonkey/jslock.c +0 -1309
  262. data/vendor/spidermonkey/jslock.h +0 -313
  263. data/vendor/spidermonkey/jslocko.asm +0 -60
  264. data/vendor/spidermonkey/jslog2.c +0 -94
  265. data/vendor/spidermonkey/jslong.c +0 -264
  266. data/vendor/spidermonkey/jslong.h +0 -412
  267. data/vendor/spidermonkey/jsmath.c +0 -567
  268. data/vendor/spidermonkey/jsmath.h +0 -57
  269. data/vendor/spidermonkey/jsnum.c +0 -1239
  270. data/vendor/spidermonkey/jsnum.h +0 -283
  271. data/vendor/spidermonkey/jsobj.c +0 -5282
  272. data/vendor/spidermonkey/jsobj.h +0 -709
  273. data/vendor/spidermonkey/jsopcode.c +0 -5245
  274. data/vendor/spidermonkey/jsopcode.h +0 -394
  275. data/vendor/spidermonkey/jsopcode.tbl +0 -523
  276. data/vendor/spidermonkey/jsotypes.h +0 -202
  277. data/vendor/spidermonkey/jsparse.c +0 -6704
  278. data/vendor/spidermonkey/jsparse.h +0 -511
  279. data/vendor/spidermonkey/jsprf.c +0 -1264
  280. data/vendor/spidermonkey/jsprf.h +0 -150
  281. data/vendor/spidermonkey/jsproto.tbl +0 -128
  282. data/vendor/spidermonkey/jsprvtd.h +0 -267
  283. data/vendor/spidermonkey/jspubtd.h +0 -744
  284. data/vendor/spidermonkey/jsregexp.c +0 -4364
  285. data/vendor/spidermonkey/jsregexp.h +0 -183
  286. data/vendor/spidermonkey/jsreops.tbl +0 -145
  287. data/vendor/spidermonkey/jsscan.c +0 -2012
  288. data/vendor/spidermonkey/jsscan.h +0 -387
  289. data/vendor/spidermonkey/jsscope.c +0 -1957
  290. data/vendor/spidermonkey/jsscope.h +0 -418
  291. data/vendor/spidermonkey/jsscript.c +0 -1832
  292. data/vendor/spidermonkey/jsscript.h +0 -287
  293. data/vendor/spidermonkey/jsshell.msg +0 -50
  294. data/vendor/spidermonkey/jsstddef.h +0 -83
  295. data/vendor/spidermonkey/jsstr.c +0 -5005
  296. data/vendor/spidermonkey/jsstr.h +0 -641
  297. data/vendor/spidermonkey/jstypes.h +0 -475
  298. data/vendor/spidermonkey/jsutil.c +0 -345
  299. data/vendor/spidermonkey/jsutil.h +0 -157
  300. data/vendor/spidermonkey/jsxdrapi.c +0 -800
  301. data/vendor/spidermonkey/jsxdrapi.h +0 -218
  302. data/vendor/spidermonkey/jsxml.c +0 -8476
  303. data/vendor/spidermonkey/jsxml.h +0 -349
  304. data/vendor/spidermonkey/lock_SunOS.s +0 -119
  305. data/vendor/spidermonkey/perfect.js +0 -39
  306. data/vendor/spidermonkey/plify_jsdhash.sed +0 -36
  307. data/vendor/spidermonkey/prmjtime.c +0 -846
  308. data/vendor/spidermonkey/prmjtime.h +0 -103
  309. data/vendor/spidermonkey/resource.h +0 -15
  310. data/vendor/spidermonkey/rules.mk +0 -197
  311. data/vendor/spidermonkey/win32.order +0 -384
@@ -1,315 +0,0 @@
1
- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
- *
3
- * ***** BEGIN LICENSE BLOCK *****
4
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
- *
6
- * The contents of this file are subject to the Mozilla Public License Version
7
- * 1.1 (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- * http://www.mozilla.org/MPL/
10
- *
11
- * Software distributed under the License is distributed on an "AS IS" basis,
12
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
- * for the specific language governing rights and limitations under the
14
- * License.
15
- *
16
- * The Original Code is Mozilla Communicator client code, released
17
- * March 31, 1998.
18
- *
19
- * The Initial Developer of the Original Code is
20
- * Sun Microsystems, Inc.
21
- * Portions created by the Initial Developer are Copyright (C) 1998
22
- * the Initial Developer. All Rights Reserved.
23
- *
24
- * Contributor(s):
25
- *
26
- * Alternatively, the contents of this file may be used under the terms of
27
- * either of the GNU General Public License Version 2 or later (the "GPL"),
28
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
- * in which case the provisions of the GPL or the LGPL are applicable instead
30
- * of those above. If you wish to allow use of your version of this file only
31
- * under the terms of either the GPL or the LGPL, and not to allow others to
32
- * use your version of this file under the terms of the MPL, indicate your
33
- * decision by deleting the provisions above and replace them with the notice
34
- * and other provisions required by the GPL or the LGPL. If you do not delete
35
- * the provisions above, a recipient may use your version of this file under
36
- * the terms of any one of the MPL, the GPL or the LGPL.
37
- *
38
- * ***** END LICENSE BLOCK ***** */
39
-
40
- /* @(#)e_jn.c 1.4 95/01/18 */
41
- /*
42
- * ====================================================
43
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
44
- *
45
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
46
- * Permission to use, copy, modify, and distribute this
47
- * software is freely granted, provided that this notice
48
- * is preserved.
49
- * ====================================================
50
- */
51
-
52
- /*
53
- * __ieee754_jn(n, x), __ieee754_yn(n, x)
54
- * floating point Bessel's function of the 1st and 2nd kind
55
- * of order n
56
- *
57
- * Special cases:
58
- * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
59
- * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
60
- * Note 2. About jn(n,x), yn(n,x)
61
- * For n=0, j0(x) is called,
62
- * for n=1, j1(x) is called,
63
- * for n<x, forward recursion us used starting
64
- * from values of j0(x) and j1(x).
65
- * for n>x, a continued fraction approximation to
66
- * j(n,x)/j(n-1,x) is evaluated and then backward
67
- * recursion is used starting from a supposed value
68
- * for j(n,x). The resulting value of j(0,x) is
69
- * compared with the actual value to correct the
70
- * supposed value of j(n,x).
71
- *
72
- * yn(n,x) is similar in all respects, except
73
- * that forward recursion is used for all
74
- * values of n>1.
75
- *
76
- */
77
-
78
- #include "fdlibm.h"
79
-
80
- #ifdef __STDC__
81
- static const double
82
- #else
83
- static double
84
- #endif
85
- invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */
86
- two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */
87
- one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */
88
-
89
- static double zero = 0.00000000000000000000e+00;
90
-
91
- #ifdef __STDC__
92
- double __ieee754_jn(int n, double x)
93
- #else
94
- double __ieee754_jn(n,x)
95
- int n; double x;
96
- #endif
97
- {
98
- fd_twoints u;
99
- int i,hx,ix,lx, sgn;
100
- double a, b, temp, di;
101
- double z, w;
102
-
103
- /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)
104
- * Thus, J(-n,x) = J(n,-x)
105
- */
106
- u.d = x;
107
- hx = __HI(u);
108
- ix = 0x7fffffff&hx;
109
- lx = __LO(u);
110
- /* if J(n,NaN) is NaN */
111
- if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x;
112
- if(n<0){
113
- n = -n;
114
- x = -x;
115
- hx ^= 0x80000000;
116
- }
117
- if(n==0) return(__ieee754_j0(x));
118
- if(n==1) return(__ieee754_j1(x));
119
- sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */
120
- x = fd_fabs(x);
121
- if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */
122
- b = zero;
123
- else if((double)n<=x) {
124
- /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */
125
- if(ix>=0x52D00000) { /* x > 2**302 */
126
- /* (x >> n**2)
127
- * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
128
- * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
129
- * Let s=sin(x), c=cos(x),
130
- * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
131
- *
132
- * n sin(xn)*sqt2 cos(xn)*sqt2
133
- * ----------------------------------
134
- * 0 s-c c+s
135
- * 1 -s-c -c+s
136
- * 2 -s+c -c-s
137
- * 3 s+c c-s
138
- */
139
- switch(n&3) {
140
- case 0: temp = fd_cos(x)+fd_sin(x); break;
141
- case 1: temp = -fd_cos(x)+fd_sin(x); break;
142
- case 2: temp = -fd_cos(x)-fd_sin(x); break;
143
- case 3: temp = fd_cos(x)-fd_sin(x); break;
144
- }
145
- b = invsqrtpi*temp/fd_sqrt(x);
146
- } else {
147
- a = __ieee754_j0(x);
148
- b = __ieee754_j1(x);
149
- for(i=1;i<n;i++){
150
- temp = b;
151
- b = b*((double)(i+i)/x) - a; /* avoid underflow */
152
- a = temp;
153
- }
154
- }
155
- } else {
156
- if(ix<0x3e100000) { /* x < 2**-29 */
157
- /* x is tiny, return the first Taylor expansion of J(n,x)
158
- * J(n,x) = 1/n!*(x/2)^n - ...
159
- */
160
- if(n>33) /* underflow */
161
- b = zero;
162
- else {
163
- temp = x*0.5; b = temp;
164
- for (a=one,i=2;i<=n;i++) {
165
- a *= (double)i; /* a = n! */
166
- b *= temp; /* b = (x/2)^n */
167
- }
168
- b = b/a;
169
- }
170
- } else {
171
- /* use backward recurrence */
172
- /* x x^2 x^2
173
- * J(n,x)/J(n-1,x) = ---- ------ ------ .....
174
- * 2n - 2(n+1) - 2(n+2)
175
- *
176
- * 1 1 1
177
- * (for large x) = ---- ------ ------ .....
178
- * 2n 2(n+1) 2(n+2)
179
- * -- - ------ - ------ -
180
- * x x x
181
- *
182
- * Let w = 2n/x and h=2/x, then the above quotient
183
- * is equal to the continued fraction:
184
- * 1
185
- * = -----------------------
186
- * 1
187
- * w - -----------------
188
- * 1
189
- * w+h - ---------
190
- * w+2h - ...
191
- *
192
- * To determine how many terms needed, let
193
- * Q(0) = w, Q(1) = w(w+h) - 1,
194
- * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),
195
- * When Q(k) > 1e4 good for single
196
- * When Q(k) > 1e9 good for double
197
- * When Q(k) > 1e17 good for quadruple
198
- */
199
- /* determine k */
200
- double t,v;
201
- double q0,q1,h,tmp; int k,m;
202
- w = (n+n)/(double)x; h = 2.0/(double)x;
203
- q0 = w; z = w+h; q1 = w*z - 1.0; k=1;
204
- while(q1<1.0e9) {
205
- k += 1; z += h;
206
- tmp = z*q1 - q0;
207
- q0 = q1;
208
- q1 = tmp;
209
- }
210
- m = n+n;
211
- for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t);
212
- a = t;
213
- b = one;
214
- /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)
215
- * Hence, if n*(log(2n/x)) > ...
216
- * single 8.8722839355e+01
217
- * double 7.09782712893383973096e+02
218
- * long double 1.1356523406294143949491931077970765006170e+04
219
- * then recurrent value may overflow and the result is
220
- * likely underflow to zero
221
- */
222
- tmp = n;
223
- v = two/x;
224
- tmp = tmp*__ieee754_log(fd_fabs(v*tmp));
225
- if(tmp<7.09782712893383973096e+02) {
226
- for(i=n-1,di=(double)(i+i);i>0;i--){
227
- temp = b;
228
- b *= di;
229
- b = b/x - a;
230
- a = temp;
231
- di -= two;
232
- }
233
- } else {
234
- for(i=n-1,di=(double)(i+i);i>0;i--){
235
- temp = b;
236
- b *= di;
237
- b = b/x - a;
238
- a = temp;
239
- di -= two;
240
- /* scale b to avoid spurious overflow */
241
- if(b>1e100) {
242
- a /= b;
243
- t /= b;
244
- b = one;
245
- }
246
- }
247
- }
248
- b = (t*__ieee754_j0(x)/b);
249
- }
250
- }
251
- if(sgn==1) return -b; else return b;
252
- }
253
-
254
- #ifdef __STDC__
255
- double __ieee754_yn(int n, double x)
256
- #else
257
- double __ieee754_yn(n,x)
258
- int n; double x;
259
- #endif
260
- {
261
- fd_twoints u;
262
- int i,hx,ix,lx;
263
- int sign;
264
- double a, b, temp;
265
-
266
- u.d = x;
267
- hx = __HI(u);
268
- ix = 0x7fffffff&hx;
269
- lx = __LO(u);
270
- /* if Y(n,NaN) is NaN */
271
- if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x;
272
- if((ix|lx)==0) return -one/zero;
273
- if(hx<0) return zero/zero;
274
- sign = 1;
275
- if(n<0){
276
- n = -n;
277
- sign = 1 - ((n&1)<<1);
278
- }
279
- if(n==0) return(__ieee754_y0(x));
280
- if(n==1) return(sign*__ieee754_y1(x));
281
- if(ix==0x7ff00000) return zero;
282
- if(ix>=0x52D00000) { /* x > 2**302 */
283
- /* (x >> n**2)
284
- * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)
285
- * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)
286
- * Let s=sin(x), c=cos(x),
287
- * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then
288
- *
289
- * n sin(xn)*sqt2 cos(xn)*sqt2
290
- * ----------------------------------
291
- * 0 s-c c+s
292
- * 1 -s-c -c+s
293
- * 2 -s+c -c-s
294
- * 3 s+c c-s
295
- */
296
- switch(n&3) {
297
- case 0: temp = fd_sin(x)-fd_cos(x); break;
298
- case 1: temp = -fd_sin(x)-fd_cos(x); break;
299
- case 2: temp = -fd_sin(x)+fd_cos(x); break;
300
- case 3: temp = fd_sin(x)+fd_cos(x); break;
301
- }
302
- b = invsqrtpi*temp/fd_sqrt(x);
303
- } else {
304
- a = __ieee754_y0(x);
305
- b = __ieee754_y1(x);
306
- /* quit if b is -inf */
307
- u.d = b;
308
- for(i=1;i<n&&(__HI(u) != 0xfff00000);i++){
309
- temp = b;
310
- b = ((double)(i+i)/x)*b - a;
311
- a = temp;
312
- }
313
- }
314
- if(sign>0) return b; else return -b;
315
- }
@@ -1,71 +0,0 @@
1
- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
- *
3
- * ***** BEGIN LICENSE BLOCK *****
4
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
- *
6
- * The contents of this file are subject to the Mozilla Public License Version
7
- * 1.1 (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- * http://www.mozilla.org/MPL/
10
- *
11
- * Software distributed under the License is distributed on an "AS IS" basis,
12
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
- * for the specific language governing rights and limitations under the
14
- * License.
15
- *
16
- * The Original Code is Mozilla Communicator client code, released
17
- * March 31, 1998.
18
- *
19
- * The Initial Developer of the Original Code is
20
- * Sun Microsystems, Inc.
21
- * Portions created by the Initial Developer are Copyright (C) 1998
22
- * the Initial Developer. All Rights Reserved.
23
- *
24
- * Contributor(s):
25
- *
26
- * Alternatively, the contents of this file may be used under the terms of
27
- * either of the GNU General Public License Version 2 or later (the "GPL"),
28
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
- * in which case the provisions of the GPL or the LGPL are applicable instead
30
- * of those above. If you wish to allow use of your version of this file only
31
- * under the terms of either the GPL or the LGPL, and not to allow others to
32
- * use your version of this file under the terms of the MPL, indicate your
33
- * decision by deleting the provisions above and replace them with the notice
34
- * and other provisions required by the GPL or the LGPL. If you do not delete
35
- * the provisions above, a recipient may use your version of this file under
36
- * the terms of any one of the MPL, the GPL or the LGPL.
37
- *
38
- * ***** END LICENSE BLOCK ***** */
39
-
40
- /* @(#)e_lgamma.c 1.3 95/01/18 */
41
- /*
42
- * ====================================================
43
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
44
- *
45
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
46
- * Permission to use, copy, modify, and distribute this
47
- * software is freely granted, provided that this notice
48
- * is preserved.
49
- * ====================================================
50
- *
51
- */
52
-
53
- /* __ieee754_lgamma(x)
54
- * Return the logarithm of the Gamma function of x.
55
- *
56
- * Method: call __ieee754_lgamma_r
57
- */
58
-
59
- #include "fdlibm.h"
60
-
61
- extern int signgam;
62
-
63
- #ifdef __STDC__
64
- double __ieee754_lgamma(double x)
65
- #else
66
- double __ieee754_lgamma(x)
67
- double x;
68
- #endif
69
- {
70
- return __ieee754_lgamma_r(x,&signgam);
71
- }
@@ -1,347 +0,0 @@
1
- /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
- *
3
- * ***** BEGIN LICENSE BLOCK *****
4
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
- *
6
- * The contents of this file are subject to the Mozilla Public License Version
7
- * 1.1 (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- * http://www.mozilla.org/MPL/
10
- *
11
- * Software distributed under the License is distributed on an "AS IS" basis,
12
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13
- * for the specific language governing rights and limitations under the
14
- * License.
15
- *
16
- * The Original Code is Mozilla Communicator client code, released
17
- * March 31, 1998.
18
- *
19
- * The Initial Developer of the Original Code is
20
- * Sun Microsystems, Inc.
21
- * Portions created by the Initial Developer are Copyright (C) 1998
22
- * the Initial Developer. All Rights Reserved.
23
- *
24
- * Contributor(s):
25
- *
26
- * Alternatively, the contents of this file may be used under the terms of
27
- * either of the GNU General Public License Version 2 or later (the "GPL"),
28
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29
- * in which case the provisions of the GPL or the LGPL are applicable instead
30
- * of those above. If you wish to allow use of your version of this file only
31
- * under the terms of either the GPL or the LGPL, and not to allow others to
32
- * use your version of this file under the terms of the MPL, indicate your
33
- * decision by deleting the provisions above and replace them with the notice
34
- * and other provisions required by the GPL or the LGPL. If you do not delete
35
- * the provisions above, a recipient may use your version of this file under
36
- * the terms of any one of the MPL, the GPL or the LGPL.
37
- *
38
- * ***** END LICENSE BLOCK ***** */
39
-
40
- /* @(#)e_lgamma_r.c 1.3 95/01/18 */
41
- /*
42
- * ====================================================
43
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
44
- *
45
- * Developed at SunSoft, a Sun Microsystems, Inc. business.
46
- * Permission to use, copy, modify, and distribute this
47
- * software is freely granted, provided that this notice
48
- * is preserved.
49
- * ====================================================
50
- *
51
- */
52
-
53
- /* __ieee754_lgamma_r(x, signgamp)
54
- * Reentrant version of the logarithm of the Gamma function
55
- * with user provide pointer for the sign of Gamma(x).
56
- *
57
- * Method:
58
- * 1. Argument Reduction for 0 < x <= 8
59
- * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may
60
- * reduce x to a number in [1.5,2.5] by
61
- * lgamma(1+s) = log(s) + lgamma(s)
62
- * for example,
63
- * lgamma(7.3) = log(6.3) + lgamma(6.3)
64
- * = log(6.3*5.3) + lgamma(5.3)
65
- * = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3)
66
- * 2. Polynomial approximation of lgamma around its
67
- * minimun ymin=1.461632144968362245 to maintain monotonicity.
68
- * On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use
69
- * Let z = x-ymin;
70
- * lgamma(x) = -1.214862905358496078218 + z^2*poly(z)
71
- * where
72
- * poly(z) is a 14 degree polynomial.
73
- * 2. Rational approximation in the primary interval [2,3]
74
- * We use the following approximation:
75
- * s = x-2.0;
76
- * lgamma(x) = 0.5*s + s*P(s)/Q(s)
77
- * with accuracy
78
- * |P/Q - (lgamma(x)-0.5s)| < 2**-61.71
79
- * Our algorithms are based on the following observation
80
- *
81
- * zeta(2)-1 2 zeta(3)-1 3
82
- * lgamma(2+s) = s*(1-Euler) + --------- * s - --------- * s + ...
83
- * 2 3
84
- *
85
- * where Euler = 0.5771... is the Euler constant, which is very
86
- * close to 0.5.
87
- *
88
- * 3. For x>=8, we have
89
- * lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+....
90
- * (better formula:
91
- * lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...)
92
- * Let z = 1/x, then we approximation
93
- * f(z) = lgamma(x) - (x-0.5)(log(x)-1)
94
- * by
95
- * 3 5 11
96
- * w = w0 + w1*z + w2*z + w3*z + ... + w6*z
97
- * where
98
- * |w - f(z)| < 2**-58.74
99
- *
100
- * 4. For negative x, since (G is gamma function)
101
- * -x*G(-x)*G(x) = pi/sin(pi*x),
102
- * we have
103
- * G(x) = pi/(sin(pi*x)*(-x)*G(-x))
104
- * since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0
105
- * Hence, for x<0, signgam = sign(sin(pi*x)) and
106
- * lgamma(x) = log(|Gamma(x)|)
107
- * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x);
108
- * Note: one should avoid compute pi*(-x) directly in the
109
- * computation of sin(pi*(-x)).
110
- *
111
- * 5. Special Cases
112
- * lgamma(2+s) ~ s*(1-Euler) for tiny s
113
- * lgamma(1)=lgamma(2)=0
114
- * lgamma(x) ~ -log(x) for tiny x
115
- * lgamma(0) = lgamma(inf) = inf
116
- * lgamma(-integer) = +-inf
117
- *
118
- */
119
-
120
- #include "fdlibm.h"
121
-
122
- #ifdef __STDC__
123
- static const double
124
- #else
125
- static double
126
- #endif
127
- two52= 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
128
- half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
129
- one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
130
- pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
131
- a0 = 7.72156649015328655494e-02, /* 0x3FB3C467, 0xE37DB0C8 */
132
- a1 = 3.22467033424113591611e-01, /* 0x3FD4A34C, 0xC4A60FAD */
133
- a2 = 6.73523010531292681824e-02, /* 0x3FB13E00, 0x1A5562A7 */
134
- a3 = 2.05808084325167332806e-02, /* 0x3F951322, 0xAC92547B */
135
- a4 = 7.38555086081402883957e-03, /* 0x3F7E404F, 0xB68FEFE8 */
136
- a5 = 2.89051383673415629091e-03, /* 0x3F67ADD8, 0xCCB7926B */
137
- a6 = 1.19270763183362067845e-03, /* 0x3F538A94, 0x116F3F5D */
138
- a7 = 5.10069792153511336608e-04, /* 0x3F40B6C6, 0x89B99C00 */
139
- a8 = 2.20862790713908385557e-04, /* 0x3F2CF2EC, 0xED10E54D */
140
- a9 = 1.08011567247583939954e-04, /* 0x3F1C5088, 0x987DFB07 */
141
- a10 = 2.52144565451257326939e-05, /* 0x3EFA7074, 0x428CFA52 */
142
- a11 = 4.48640949618915160150e-05, /* 0x3F07858E, 0x90A45837 */
143
- tc = 1.46163214496836224576e+00, /* 0x3FF762D8, 0x6356BE3F */
144
- tf = -1.21486290535849611461e-01, /* 0xBFBF19B9, 0xBCC38A42 */
145
- /* tt = -(tail of tf) */
146
- tt = -3.63867699703950536541e-18, /* 0xBC50C7CA, 0xA48A971F */
147
- t0 = 4.83836122723810047042e-01, /* 0x3FDEF72B, 0xC8EE38A2 */
148
- t1 = -1.47587722994593911752e-01, /* 0xBFC2E427, 0x8DC6C509 */
149
- t2 = 6.46249402391333854778e-02, /* 0x3FB08B42, 0x94D5419B */
150
- t3 = -3.27885410759859649565e-02, /* 0xBFA0C9A8, 0xDF35B713 */
151
- t4 = 1.79706750811820387126e-02, /* 0x3F9266E7, 0x970AF9EC */
152
- t5 = -1.03142241298341437450e-02, /* 0xBF851F9F, 0xBA91EC6A */
153
- t6 = 6.10053870246291332635e-03, /* 0x3F78FCE0, 0xE370E344 */
154
- t7 = -3.68452016781138256760e-03, /* 0xBF6E2EFF, 0xB3E914D7 */
155
- t8 = 2.25964780900612472250e-03, /* 0x3F6282D3, 0x2E15C915 */
156
- t9 = -1.40346469989232843813e-03, /* 0xBF56FE8E, 0xBF2D1AF1 */
157
- t10 = 8.81081882437654011382e-04, /* 0x3F4CDF0C, 0xEF61A8E9 */
158
- t11 = -5.38595305356740546715e-04, /* 0xBF41A610, 0x9C73E0EC */
159
- t12 = 3.15632070903625950361e-04, /* 0x3F34AF6D, 0x6C0EBBF7 */
160
- t13 = -3.12754168375120860518e-04, /* 0xBF347F24, 0xECC38C38 */
161
- t14 = 3.35529192635519073543e-04, /* 0x3F35FD3E, 0xE8C2D3F4 */
162
- u0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */
163
- u1 = 6.32827064025093366517e-01, /* 0x3FE4401E, 0x8B005DFF */
164
- u2 = 1.45492250137234768737e+00, /* 0x3FF7475C, 0xD119BD6F */
165
- u3 = 9.77717527963372745603e-01, /* 0x3FEF4976, 0x44EA8450 */
166
- u4 = 2.28963728064692451092e-01, /* 0x3FCD4EAE, 0xF6010924 */
167
- u5 = 1.33810918536787660377e-02, /* 0x3F8B678B, 0xBF2BAB09 */
168
- v1 = 2.45597793713041134822e+00, /* 0x4003A5D7, 0xC2BD619C */
169
- v2 = 2.12848976379893395361e+00, /* 0x40010725, 0xA42B18F5 */
170
- v3 = 7.69285150456672783825e-01, /* 0x3FE89DFB, 0xE45050AF */
171
- v4 = 1.04222645593369134254e-01, /* 0x3FBAAE55, 0xD6537C88 */
172
- v5 = 3.21709242282423911810e-03, /* 0x3F6A5ABB, 0x57D0CF61 */
173
- s0 = -7.72156649015328655494e-02, /* 0xBFB3C467, 0xE37DB0C8 */
174
- s1 = 2.14982415960608852501e-01, /* 0x3FCB848B, 0x36E20878 */
175
- s2 = 3.25778796408930981787e-01, /* 0x3FD4D98F, 0x4F139F59 */
176
- s3 = 1.46350472652464452805e-01, /* 0x3FC2BB9C, 0xBEE5F2F7 */
177
- s4 = 2.66422703033638609560e-02, /* 0x3F9B481C, 0x7E939961 */
178
- s5 = 1.84028451407337715652e-03, /* 0x3F5E26B6, 0x7368F239 */
179
- s6 = 3.19475326584100867617e-05, /* 0x3F00BFEC, 0xDD17E945 */
180
- r1 = 1.39200533467621045958e+00, /* 0x3FF645A7, 0x62C4AB74 */
181
- r2 = 7.21935547567138069525e-01, /* 0x3FE71A18, 0x93D3DCDC */
182
- r3 = 1.71933865632803078993e-01, /* 0x3FC601ED, 0xCCFBDF27 */
183
- r4 = 1.86459191715652901344e-02, /* 0x3F9317EA, 0x742ED475 */
184
- r5 = 7.77942496381893596434e-04, /* 0x3F497DDA, 0xCA41A95B */
185
- r6 = 7.32668430744625636189e-06, /* 0x3EDEBAF7, 0xA5B38140 */
186
- w0 = 4.18938533204672725052e-01, /* 0x3FDACFE3, 0x90C97D69 */
187
- w1 = 8.33333333333329678849e-02, /* 0x3FB55555, 0x5555553B */
188
- w2 = -2.77777777728775536470e-03, /* 0xBF66C16C, 0x16B02E5C */
189
- w3 = 7.93650558643019558500e-04, /* 0x3F4A019F, 0x98CF38B6 */
190
- w4 = -5.95187557450339963135e-04, /* 0xBF4380CB, 0x8C0FE741 */
191
- w5 = 8.36339918996282139126e-04, /* 0x3F4B67BA, 0x4CDAD5D1 */
192
- w6 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */
193
-
194
- static double zero= 0.00000000000000000000e+00;
195
-
196
- #ifdef __STDC__
197
- static double sin_pi(double x)
198
- #else
199
- static double sin_pi(x)
200
- double x;
201
- #endif
202
- {
203
- fd_twoints u;
204
- double y,z;
205
- int n,ix;
206
-
207
- u.d = x;
208
- ix = 0x7fffffff&__HI(u);
209
-
210
- if(ix<0x3fd00000) return __kernel_sin(pi*x,zero,0);
211
- y = -x; /* x is assume negative */
212
-
213
- /*
214
- * argument reduction, make sure inexact flag not raised if input
215
- * is an integer
216
- */
217
- z = fd_floor(y);
218
- if(z!=y) { /* inexact anyway */
219
- y *= 0.5;
220
- y = 2.0*(y - fd_floor(y)); /* y = |x| mod 2.0 */
221
- n = (int) (y*4.0);
222
- } else {
223
- if(ix>=0x43400000) {
224
- y = zero; n = 0; /* y must be even */
225
- } else {
226
- if(ix<0x43300000) z = y+two52; /* exact */
227
- u.d = z;
228
- n = __LO(u)&1; /* lower word of z */
229
- y = n;
230
- n<<= 2;
231
- }
232
- }
233
- switch (n) {
234
- case 0: y = __kernel_sin(pi*y,zero,0); break;
235
- case 1:
236
- case 2: y = __kernel_cos(pi*(0.5-y),zero); break;
237
- case 3:
238
- case 4: y = __kernel_sin(pi*(one-y),zero,0); break;
239
- case 5:
240
- case 6: y = -__kernel_cos(pi*(y-1.5),zero); break;
241
- default: y = __kernel_sin(pi*(y-2.0),zero,0); break;
242
- }
243
- return -y;
244
- }
245
-
246
-
247
- #ifdef __STDC__
248
- double __ieee754_lgamma_r(double x, int *signgamp)
249
- #else
250
- double __ieee754_lgamma_r(x,signgamp)
251
- double x; int *signgamp;
252
- #endif
253
- {
254
- fd_twoints u;
255
- double t,y,z,nadj,p,p1,p2,p3,q,r,w;
256
- int i,hx,lx,ix;
257
-
258
- u.d = x;
259
- hx = __HI(u);
260
- lx = __LO(u);
261
-
262
- /* purge off +-inf, NaN, +-0, and negative arguments */
263
- *signgamp = 1;
264
- ix = hx&0x7fffffff;
265
- if(ix>=0x7ff00000) return x*x;
266
- if((ix|lx)==0) return one/zero;
267
- if(ix<0x3b900000) { /* |x|<2**-70, return -log(|x|) */
268
- if(hx<0) {
269
- *signgamp = -1;
270
- return -__ieee754_log(-x);
271
- } else return -__ieee754_log(x);
272
- }
273
- if(hx<0) {
274
- if(ix>=0x43300000) /* |x|>=2**52, must be -integer */
275
- return one/zero;
276
- t = sin_pi(x);
277
- if(t==zero) return one/zero; /* -integer */
278
- nadj = __ieee754_log(pi/fd_fabs(t*x));
279
- if(t<zero) *signgamp = -1;
280
- x = -x;
281
- }
282
-
283
- /* purge off 1 and 2 */
284
- if((((ix-0x3ff00000)|lx)==0)||(((ix-0x40000000)|lx)==0)) r = 0;
285
- /* for x < 2.0 */
286
- else if(ix<0x40000000) {
287
- if(ix<=0x3feccccc) { /* lgamma(x) = lgamma(x+1)-log(x) */
288
- r = -__ieee754_log(x);
289
- if(ix>=0x3FE76944) {y = one-x; i= 0;}
290
- else if(ix>=0x3FCDA661) {y= x-(tc-one); i=1;}
291
- else {y = x; i=2;}
292
- } else {
293
- r = zero;
294
- if(ix>=0x3FFBB4C3) {y=2.0-x;i=0;} /* [1.7316,2] */
295
- else if(ix>=0x3FF3B4C4) {y=x-tc;i=1;} /* [1.23,1.73] */
296
- else {y=x-one;i=2;}
297
- }
298
- switch(i) {
299
- case 0:
300
- z = y*y;
301
- p1 = a0+z*(a2+z*(a4+z*(a6+z*(a8+z*a10))));
302
- p2 = z*(a1+z*(a3+z*(a5+z*(a7+z*(a9+z*a11)))));
303
- p = y*p1+p2;
304
- r += (p-0.5*y); break;
305
- case 1:
306
- z = y*y;
307
- w = z*y;
308
- p1 = t0+w*(t3+w*(t6+w*(t9 +w*t12))); /* parallel comp */
309
- p2 = t1+w*(t4+w*(t7+w*(t10+w*t13)));
310
- p3 = t2+w*(t5+w*(t8+w*(t11+w*t14)));
311
- p = z*p1-(tt-w*(p2+y*p3));
312
- r += (tf + p); break;
313
- case 2:
314
- p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5)))));
315
- p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5))));
316
- r += (-0.5*y + p1/p2);
317
- }
318
- }
319
- else if(ix<0x40200000) { /* x < 8.0 */
320
- i = (int)x;
321
- t = zero;
322
- y = x-(double)i;
323
- p = y*(s0+y*(s1+y*(s2+y*(s3+y*(s4+y*(s5+y*s6))))));
324
- q = one+y*(r1+y*(r2+y*(r3+y*(r4+y*(r5+y*r6)))));
325
- r = half*y+p/q;
326
- z = one; /* lgamma(1+s) = log(s) + lgamma(s) */
327
- switch(i) {
328
- case 7: z *= (y+6.0); /* FALLTHRU */
329
- case 6: z *= (y+5.0); /* FALLTHRU */
330
- case 5: z *= (y+4.0); /* FALLTHRU */
331
- case 4: z *= (y+3.0); /* FALLTHRU */
332
- case 3: z *= (y+2.0); /* FALLTHRU */
333
- r += __ieee754_log(z); break;
334
- }
335
- /* 8.0 <= x < 2**58 */
336
- } else if (ix < 0x43900000) {
337
- t = __ieee754_log(x);
338
- z = one/x;
339
- y = z*z;
340
- w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6)))));
341
- r = (x-half)*(t-one)+w;
342
- } else
343
- /* 2**58 <= x <= inf */
344
- r = x*(__ieee754_log(x)-one);
345
- if(hx<0) r = nadj - r;
346
- return r;
347
- }