@ohos-ports/stdlib-math-base-special-gammaln 0.3.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,192 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ DEPENDENCIES & ATTRIBUTION
180
+
181
+ The library links against the following external libraries or contains
182
+ implementations from the following external libraries, which have their own
183
+ licenses:
184
+
185
+ * FreeBSD <https://svnweb.freebsd.org/>
186
+
187
+ Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.
188
+
189
+ Developed at SunPro, a Sun Microsystems, Inc. business.
190
+ Permission to use, copy, modify, and distribute this
191
+ software is freely granted, provided that this notice
192
+ is preserved.
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md ADDED
@@ -0,0 +1,294 @@
1
+ <!--
2
+
3
+ @license Apache-2.0
4
+
5
+ Copyright (c) 2018 The Stdlib Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
20
+
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
32
+ # gammaln
33
+
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
+
36
+ > [Natural logarithm][@stdlib/math/base/special/ln] of the [gamma][@stdlib/math/base/special/gamma] function.
37
+
38
+ <section class="installation">
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ npm install @stdlib/math-base-special-gammaln
44
+ ```
45
+
46
+ </section>
47
+
48
+ <section class="usage">
49
+
50
+ ## Usage
51
+
52
+ ```javascript
53
+ var gammaln = require( '@stdlib/math-base-special-gammaln' );
54
+ ```
55
+
56
+ #### gammaln( x )
57
+
58
+ Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of the [gamma function][@stdlib/math/base/special/gamma].
59
+
60
+ ```javascript
61
+ var v = gammaln( 2.0 );
62
+ // returns 0.0
63
+
64
+ v = gammaln( 1.0 );
65
+ // returns 0.0
66
+
67
+ v = gammaln( 4.0 );
68
+ // returns ~1.792
69
+
70
+ v = gammaln( -0.5 );
71
+ // returns ~1.266
72
+
73
+ v = gammaln( 0.5 );
74
+ // returns ~0.572
75
+
76
+ v = gammaln( 0.0 );
77
+ // returns Infinity
78
+
79
+ v = gammaln( NaN );
80
+ // returns NaN
81
+ ```
82
+
83
+ </section>
84
+
85
+ <!-- /.usage -->
86
+
87
+ <section class="examples">
88
+
89
+ ## Examples
90
+
91
+ <!-- eslint no-undef: "error" -->
92
+
93
+ ```javascript
94
+ var uniform = require( '@stdlib/random-array-uniform' );
95
+ var logEachMap = require( '@stdlib/console-log-each-map' );
96
+ var gammaln = require( '@stdlib/math-base-special-gammaln' );
97
+
98
+ var opts = {
99
+ 'dtype': 'float64'
100
+ };
101
+ var x = uniform( 100, -10.0, 10.0, opts );
102
+
103
+ logEachMap( 'x: %0.4f, f(x): %0.4f', x, gammaln );
104
+ ```
105
+
106
+ </section>
107
+
108
+ <!-- /.examples -->
109
+
110
+ <!-- C interface documentation. -->
111
+
112
+ * * *
113
+
114
+ <section class="c">
115
+
116
+ ## C APIs
117
+
118
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
119
+
120
+ <section class="intro">
121
+
122
+ </section>
123
+
124
+ <!-- /.intro -->
125
+
126
+ <!-- C usage documentation. -->
127
+
128
+ <section class="usage">
129
+
130
+ ### Usage
131
+
132
+ ```c
133
+ #include "stdlib/math/base/special/gammaln.h"
134
+ ```
135
+
136
+ #### stdlib_base_gammaln( x )
137
+
138
+ Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of the [gamma function][@stdlib/math/base/special/gamma].
139
+
140
+ ```c
141
+ double out = stdlib_base_gammaln( 2.0 );
142
+ // returns 0.0
143
+
144
+ out = stdlib_base_gammaln( 4.0 );
145
+ // returns ~1.792
146
+ ```
147
+
148
+ The function accepts the following arguments:
149
+
150
+ - **x**: `[in] double` input value.
151
+
152
+ ```c
153
+ double stdlib_base_gammaln( const double x );
154
+ ```
155
+
156
+ </section>
157
+
158
+ <!-- /.usage -->
159
+
160
+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
161
+
162
+ <section class="notes">
163
+
164
+ </section>
165
+
166
+ <!-- /.notes -->
167
+
168
+ <!-- C API usage examples. -->
169
+
170
+ <section class="examples">
171
+
172
+ ### Examples
173
+
174
+ ```c
175
+ #include "stdlib/math/base/special/gammaln.h"
176
+ #include <stdlib.h>
177
+ #include <stdio.h>
178
+
179
+ int main( void ) {
180
+ const double x[] = { 4.0, -1.5, -0.5, 0.5 };
181
+
182
+ double y;
183
+ int i;
184
+ for ( i = 0; i < 4; i++ ) {
185
+ y = stdlib_base_gammaln( x[ i ] );
186
+ printf( "gammaln(%lf) = %lf\n", x[ i ], y );
187
+ }
188
+ }
189
+ ```
190
+
191
+ </section>
192
+
193
+ <!-- /.examples -->
194
+
195
+ </section>
196
+
197
+ <!-- /.c -->
198
+
199
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
200
+
201
+ <section class="related">
202
+
203
+ * * *
204
+
205
+ ## See Also
206
+
207
+ - <span class="package-name">[`@stdlib/math-base/special/gamma`][@stdlib/math/base/special/gamma]</span><span class="delimiter">: </span><span class="description">gamma function.</span>
208
+ - <span class="package-name">[`@stdlib/math-base/special/gammainc`][@stdlib/math/base/special/gammainc]</span><span class="delimiter">: </span><span class="description">incomplete gamma function.</span>
209
+ - <span class="package-name">[`@stdlib/math-base/special/gammaincinv`][@stdlib/math/base/special/gammaincinv]</span><span class="delimiter">: </span><span class="description">inverse incomplete gamma function.</span>
210
+
211
+ </section>
212
+
213
+ <!-- /.related -->
214
+
215
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
216
+
217
+
218
+ <section class="main-repo" >
219
+
220
+ * * *
221
+
222
+ ## Notice
223
+
224
+ This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
225
+
226
+ For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
227
+
228
+ #### Community
229
+
230
+ [![Chat][chat-image]][chat-url]
231
+
232
+ ---
233
+
234
+ ## Copyright
235
+
236
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
237
+
238
+ </section>
239
+
240
+ <!-- /.stdlib -->
241
+
242
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
243
+
244
+ <section class="links">
245
+
246
+ [npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-special-gammaln.svg
247
+ [npm-url]: https://npmjs.org/package/@stdlib/math-base-special-gammaln
248
+
249
+ [test-image]: https://github.com/stdlib-js/math-base-special-gammaln/actions/workflows/test.yml/badge.svg?branch=v0.3.1
250
+ [test-url]: https://github.com/stdlib-js/math-base-special-gammaln/actions/workflows/test.yml?query=branch:v0.3.1
251
+
252
+ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-special-gammaln/main.svg
253
+ [coverage-url]: https://codecov.io/github/stdlib-js/math-base-special-gammaln?branch=main
254
+
255
+ <!--
256
+
257
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/math-base-special-gammaln.svg
258
+ [dependencies-url]: https://david-dm.org/stdlib-js/math-base-special-gammaln/main
259
+
260
+ -->
261
+
262
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
263
+ [chat-url]: https://stdlib.zulipchat.com
264
+
265
+ [stdlib]: https://github.com/stdlib-js/stdlib
266
+
267
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
268
+
269
+ [umd]: https://github.com/umdjs/umd
270
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
271
+
272
+ [deno-url]: https://github.com/stdlib-js/math-base-special-gammaln/tree/deno
273
+ [deno-readme]: https://github.com/stdlib-js/math-base-special-gammaln/blob/deno/README.md
274
+ [umd-url]: https://github.com/stdlib-js/math-base-special-gammaln/tree/umd
275
+ [umd-readme]: https://github.com/stdlib-js/math-base-special-gammaln/blob/umd/README.md
276
+ [esm-url]: https://github.com/stdlib-js/math-base-special-gammaln/tree/esm
277
+ [esm-readme]: https://github.com/stdlib-js/math-base-special-gammaln/blob/esm/README.md
278
+ [branches-url]: https://github.com/stdlib-js/math-base-special-gammaln/blob/main/branches.md
279
+
280
+ [@stdlib/math/base/special/ln]: https://www.npmjs.com/package/@stdlib/math-base-special-ln
281
+
282
+ <!-- <related-links> -->
283
+
284
+ [@stdlib/math/base/special/gamma]: https://www.npmjs.com/package/@stdlib/math-base-special-gamma
285
+
286
+ [@stdlib/math/base/special/gammainc]: https://www.npmjs.com/package/@stdlib/math-base-special-gammainc
287
+
288
+ [@stdlib/math/base/special/gammaincinv]: https://www.npmjs.com/package/@stdlib/math-base-special-gammaincinv
289
+
290
+ <!-- </related-links> -->
291
+
292
+ </section>
293
+
294
+ <!-- /.links -->
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import gammaln from '../docs/types/index';
3
+ export = gammaln;
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";var i=function(r,s){return function(){return s||r((s={exports:{}}).exports,s),s.exports}};var b=i(function(R0,I){
2
+ function D(r){return r===0?.06735230105312927:.06735230105312927+r*(.007385550860814029+r*(.0011927076318336207+r*(.00022086279071390839+r*25214456545125733e-21)))}I.exports=D
3
+ });var N=i(function(S0,A){
4
+ function E(r){return r===0?.020580808432516733:.020580808432516733+r*(.0028905138367341563+r*(.0005100697921535113+r*(.00010801156724758394+r*44864094961891516e-21)))}A.exports=E
5
+ });var g=i(function(U0,W){
6
+ function G(r){return r===0?1.3920053346762105:1.3920053346762105+r*(.7219355475671381+r*(.17193386563280308+r*(.01864591917156529+r*(.0007779424963818936+r*7326684307446256e-21))))}W.exports=G
7
+ });var m=i(function(V0,k){
8
+ function H(r){return r===0?.21498241596060885:.21498241596060885+r*(.325778796408931+r*(.14635047265246445+r*(.02664227030336386+r*(.0018402845140733772+r*3194753265841009e-20))))}k.exports=H
9
+ });var h=i(function(Y0,w){
10
+ function J(r){return r===0?-.032788541075985965:-.032788541075985965+r*(.006100538702462913+r*(-.0014034646998923284+r*.00031563207090362595))}w.exports=J
11
+ });var O=i(function(d0,F){
12
+ function K(r){return r===0?.01797067508118204:.01797067508118204+r*(-.0036845201678113826+r*(.000881081882437654+r*-.00031275416837512086))}F.exports=K
13
+ });var R=i(function(j0,P){
14
+ function L(r){return r===0?-.010314224129834144:-.010314224129834144+r*(.0022596478090061247+r*(-.0005385953053567405+r*.0003355291926355191))}P.exports=L
15
+ });var U=i(function(z0,S){
16
+ function Q(r){return r===0?.6328270640250934:.6328270640250934+r*(1.4549225013723477+r*(.9777175279633727+r*(.22896372806469245+r*.013381091853678766)))}S.exports=Q
17
+ });var Y=i(function(M0,V){
18
+ function X(r){return r===0?2.4559779371304113:2.4559779371304113+r*(2.128489763798934+r*(.7692851504566728+r*(.10422264559336913+r*.003217092422824239)))}V.exports=X
19
+ });var j=i(function(B0,d){
20
+ function Z(r){return r===0?.08333333333333297:.08333333333333297+r*(-.0027777777772877554+r*(.0007936505586430196+r*(-.00059518755745034+r*(.0008363399189962821+r*-.0016309293409657527))))}d.exports=Z
21
+ });var B=i(function(D0,M){
22
+ var _=require('@stdlib/math-base-assert-is-nan/dist'),$=require('@stdlib/math-base-assert-is-infinite/dist'),x=require('@stdlib/math-base-special-abs/dist'),f=require('@stdlib/math-base-special-ln/dist'),r0=require('@stdlib/math-base-special-trunc/dist'),e0=require('@stdlib/math-base-special-sinpi/dist'),a0=require('@stdlib/constants-float64-pi/dist'),y=require('@stdlib/constants-float64-pinf/dist'),t0=b(),i0=N(),u0=g(),v0=m(),s0=h(),n0=O(),l0=R(),o0=U(),f0=Y(),p0=j(),c0=.07721566490153287,y0=.3224670334241136,q0=1,T0=-.07721566490153287,C0=.48383612272381005,I0=-.1475877229945939,b0=.06462494023913339,A0=-.07721566490153287,N0=1,W0=.4189385332046727,c=1.4616321449683622,g0=4503599627370496,k0=72057594037927940,m0=13877787807814457e-33,z=1.4616321449683622,w0=-.12148629053584961,h0=-3638676997039505e-33;function F0(r){var s,q,u,T,n,l,o,C,p,v,e,a,t;if(_(r)||$(r))return r;if(r===0)return y;if(r<0?(s=!0,r=-r):s=!1,r<m0)return-f(r);if(s){if(r>=g0||(p=e0(r),p===0))return y;q=f(a0/x(p*r))}if(r===1||r===2)return 0;if(r<2)switch(r<=.9?(t=-f(r),r>=c-1+.27?(e=1-r,u=0):r>=c-1-.27?(e=r-(z-1),u=1):(e=r,u=2)):(t=0,r>=c+.27?(e=2-r,u=0):r>=c-.27?(e=r-z,u=1):(e=r-1,u=2)),u){case 0:a=e*e,l=c0+a*t0(a),n=a*(y0+a*i0(a)),o=e*l+n,t+=o-.5*e;break;case 1:a=e*e,v=a*e,l=C0+v*s0(v),n=I0+v*n0(v),T=b0+v*l0(v),o=a*l-(h0-v*(n+e*T)),t+=w0+o;break;case 2:l=e*(A0+e*o0(e)),n=N0+e*f0(e),t+=-.5*e+l/n;break}else if(r<8)switch(u=r0(r),e=r-u,o=e*(T0+e*v0(e)),C=q0+e*u0(e),t=.5*e+o/C,a=1,u){case 7:a*=e+6;case 6:a*=e+5;case 5:a*=e+4;case 4:a*=e+3;case 3:a*=e+2,t+=f(a)}else r<k0?(p=f(r),a=1/r,e=a*a,v=W0+a*p0(e),t=(r-.5)*(p-1)+v):t=r*(f(r)-1);return s&&(t=q-t),t}M.exports=F0
23
+ });var O0=B();module.exports=O0;
24
+ /** @license Apache-2.0 */
25
+ /** @license Apache-2.0 */
26
+ /** @license Apache-2.0 */
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/polyval_a1.js", "../lib/polyval_a2.js", "../lib/polyval_r.js", "../lib/polyval_s.js", "../lib/polyval_t1.js", "../lib/polyval_t2.js", "../lib/polyval_t3.js", "../lib/polyval_u.js", "../lib/polyval_v.js", "../lib/polyval_w.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 0.06735230105312927;\n\t}\n\treturn 0.06735230105312927 + (x * (0.007385550860814029 + (x * (0.0011927076318336207 + (x * (0.00022086279071390839 + (x * 0.000025214456545125733))))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 0.020580808432516733;\n\t}\n\treturn 0.020580808432516733 + (x * (0.0028905138367341563 + (x * (0.0005100697921535113 + (x * (0.00010801156724758394 + (x * 0.000044864094961891516))))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 1.3920053346762105;\n\t}\n\treturn 1.3920053346762105 + (x * (0.7219355475671381 + (x * (0.17193386563280308 + (x * (0.01864591917156529 + (x * (0.0007779424963818936 + (x * 0.000007326684307446256))))))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 0.21498241596060885;\n\t}\n\treturn 0.21498241596060885 + (x * (0.325778796408931 + (x * (0.14635047265246445 + (x * (0.02664227030336386 + (x * (0.0018402845140733772 + (x * 0.00003194753265841009))))))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn -0.032788541075985965;\n\t}\n\treturn -0.032788541075985965 + (x * (0.006100538702462913 + (x * (-0.0014034646998923284 + (x * 0.00031563207090362595))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 0.01797067508118204;\n\t}\n\treturn 0.01797067508118204 + (x * (-0.0036845201678113826 + (x * (0.000881081882437654 + (x * -0.00031275416837512086))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn -0.010314224129834144;\n\t}\n\treturn -0.010314224129834144 + (x * (0.0022596478090061247 + (x * (-0.0005385953053567405 + (x * 0.0003355291926355191))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 0.6328270640250934;\n\t}\n\treturn 0.6328270640250934 + (x * (1.4549225013723477 + (x * (0.9777175279633727 + (x * (0.22896372806469245 + (x * 0.013381091853678766))))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 2.4559779371304113;\n\t}\n\treturn 2.4559779371304113 + (x * (2.128489763798934 + (x * (0.7692851504566728 + (x * (0.10422264559336913 + (x * 0.003217092422824239))))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2024 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 0.08333333333333297;\n\t}\n\treturn 0.08333333333333297 + (x * (-0.0027777777772877554 + (x * (0.0007936505586430196 + (x * (-0.00059518755745034 + (x * (0.0008363399189962821 + (x * -0.0016309293409657527))))))))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = evalpoly;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*\n*\n* ## Notice\n*\n* The following copyright, license, and long comment were part of the original implementation available as part of [FreeBSD]{@link https://svnweb.freebsd.org/base/release/12.2.0/lib/msun/src/e_lgamma_r.c}. The implementation follows the original, but has been modified for JavaScript.\n*\n* ```text\n* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n*\n* Developed at SunPro, a Sun Microsystems, Inc. business.\n* Permission to use, copy, modify, and distribute this\n* software is freely granted, provided that this notice\n* is preserved.\n* ```\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isnan = require( '@stdlib/math-base-assert-is-nan' );\nvar isInfinite = require( '@stdlib/math-base-assert-is-infinite' );\nvar abs = require( '@stdlib/math-base-special-abs' );\nvar ln = require( '@stdlib/math-base-special-ln' );\nvar trunc = require( '@stdlib/math-base-special-trunc' );\nvar sinpi = require( '@stdlib/math-base-special-sinpi' );\nvar PI = require( '@stdlib/constants-float64-pi' );\nvar PINF = require( '@stdlib/constants-float64-pinf' );\nvar polyvalA1 = require( './polyval_a1.js' );\nvar polyvalA2 = require( './polyval_a2.js' );\nvar polyvalR = require( './polyval_r.js' );\nvar polyvalS = require( './polyval_s.js' );\nvar polyvalT1 = require( './polyval_t1.js' );\nvar polyvalT2 = require( './polyval_t2.js' );\nvar polyvalT3 = require( './polyval_t3.js' );\nvar polyvalU = require( './polyval_u.js' );\nvar polyvalV = require( './polyval_v.js' );\nvar polyvalW = require( './polyval_w.js' );\n\n\n// VARIABLES //\n\nvar A1C = 7.72156649015328655494e-02; // 0x3FB3C467E37DB0C8\nvar A2C = 3.22467033424113591611e-01; // 0x3FD4A34CC4A60FAD\nvar RC = 1.0;\nvar SC = -7.72156649015328655494e-02; // 0xBFB3C467E37DB0C8\nvar T1C = 4.83836122723810047042e-01; // 0x3FDEF72BC8EE38A2\nvar T2C = -1.47587722994593911752e-01; // 0xBFC2E4278DC6C509\nvar T3C = 6.46249402391333854778e-02; // 0x3FB08B4294D5419B\nvar UC = -7.72156649015328655494e-02; // 0xBFB3C467E37DB0C8\nvar VC = 1.0;\nvar WC = 4.18938533204672725052e-01; // 0x3FDACFE390C97D69\nvar YMIN = 1.461632144968362245;\nvar TWO52 = 4503599627370496; // 2**52\nvar TWO56 = 72057594037927936; // 2**56\nvar TINY = 1.3877787807814457e-17;\nvar TC = 1.46163214496836224576e+00; // 0x3FF762D86356BE3F\nvar TF = -1.21486290535849611461e-01; // 0xBFBF19B9BCC38A42\nvar TT = -3.63867699703950536541e-18; // 0xBC50C7CAA48A971F => TT = -(tail of TF)\n\n\n// MAIN //\n\n/**\n* Evaluates the natural logarithm of the gamma function.\n*\n* ## Method\n*\n* 1. Argument reduction for \\\\(0 < x \\leq 8\\\\). Since \\\\(\\Gamma(1+s) = s \\Gamma(s)\\\\), for \\\\(x \\in \\[0,8]\\\\), we may reduce \\\\(x\\\\) to a number in \\\\(\\[1.5,2.5]\\\\) by\n*\n* ```tex\n* \\operatorname{lgamma}(1+s) = \\ln(s) + \\operatorname{lgamma}(s)\n* ```\n*\n* For example,\n*\n* ```tex\n* \\begin{align*}\n* \\operatorname{lgamma}(7.3) &= \\ln(6.3) + \\operatorname{lgamma}(6.3) \\\\\n* &= \\ln(6.3 \\cdot 5.3) + \\operatorname{lgamma}(5.3) \\\\\n* &= \\ln(6.3 \\cdot 5.3 \\cdot 4.3 \\cdot 3.3 \\cdot2.3) + \\operatorname{lgamma}(2.3)\n* \\end{align*}\n* ```\n*\n* 2. Compute a polynomial approximation of \\\\(\\mathrm{lgamma}\\\\) around its minimum (\\\\(\\mathrm{ymin} = 1.461632144968362245\\\\)) to maintain monotonicity. On the interval \\\\(\\[\\mathrm{ymin} - 0.23, \\mathrm{ymin} + 0.27]\\\\) (i.e., \\\\(\\[1.23164,1.73163]\\\\)), we let \\\\(z = x - \\mathrm{ymin}\\\\) and use\n*\n* ```tex\n* \\operatorname{lgamma}(x) = -1.214862905358496078218 + z^2 \\cdot \\operatorname{poly}(z)\n* ```\n*\n* where \\\\(\\operatorname{poly}(z)\\\\) is a \\\\(14\\\\) degree polynomial.\n*\n* 3. Compute a rational approximation in the primary interval \\\\(\\[2,3]\\\\). Let \\\\( s = x - 2.0 \\\\). We can thus use the approximation\n*\n* ```tex\n* \\operatorname{lgamma}(x) = \\frac{s}{2} + s\\frac{\\operatorname{P}(s)}{\\operatorname{Q}(s)}\n* ```\n*\n* with accuracy\n*\n* ```tex\n* \\biggl|\\frac{\\mathrm{P}}{\\mathrm{Q}} - \\biggr(\\operatorname{lgamma}(x)-\\frac{s}{2}\\biggl)\\biggl| < 2^{-61.71}\n* ```\n*\n* The algorithms are based on the observation\n*\n* ```tex\n* \\operatorname{lgamma}(2+s) = s(1 - \\gamma) + \\frac{\\zeta(2) - 1}{2} s^2 - \\frac{\\zeta(3) - 1}{3} s^3 + \\ldots\n* ```\n*\n* where \\\\(\\zeta\\\\) is the zeta function and \\\\(\\gamma = 0.5772156649...\\\\) is the Euler-Mascheroni constant, which is very close to \\\\(0.5\\\\).\n*\n* 4. For \\\\(x \\geq 8\\\\),\n*\n* ```tex\n* \\operatorname{lgamma}(x) \\approx \\biggl(x-\\frac{1}{2}\\biggr) \\ln(x) - x + \\frac{\\ln(2\\pi)}{2} + \\frac{1}{12x} - \\frac{1}{360x^3} + \\ldots\n* ```\n*\n* which can be expressed\n*\n* ```tex\n* \\operatorname{lgamma}(x) \\approx \\biggl(x-\\frac{1}{2}\\biggr)(\\ln(x)-1)-\\frac{\\ln(2\\pi)-1}{2} + \\ldots\n* ```\n*\n* Let \\\\(z = \\frac{1}{x}\\\\). We can then use the approximation\n*\n* ```tex\n* f(z) = \\operatorname{lgamma}(x) - \\biggl(x-\\frac{1}{2}\\biggr)(\\ln(x)-1)\n* ```\n*\n* by\n*\n* ```tex\n* w = w_0 + w_1 z + w_2 z^3 + w_3 z^5 + \\ldots + w_6 z^{11}\n* ```\n*\n* where\n*\n* ```tex\n* |w - f(z)| < 2^{-58.74}\n* ```\n*\n* 5. For negative \\\\(x\\\\), since\n*\n* ```tex\n* -x \\Gamma(-x) \\Gamma(x) = \\frac{\\pi}{\\sin(\\pi x)}\n* ```\n*\n* where \\\\(\\Gamma\\\\) is the gamma function, we have\n*\n* ```tex\n* \\Gamma(x) = \\frac{\\pi}{\\sin(\\pi x)(-x)\\Gamma(-x)}\n* ```\n*\n* Since \\\\(\\Gamma(-x)\\\\) is positive,\n*\n* ```tex\n* \\operatorname{sign}(\\Gamma(x)) = \\operatorname{sign}(\\sin(\\pi x))\n* ```\n*\n* for \\\\(x < 0\\\\). Hence, for \\\\(x < 0\\\\),\n*\n* ```tex\n* \\mathrm{signgam} = \\operatorname{sign}(\\sin(\\pi x))\n* ```\n*\n* and\n*\n* ```tex\n* \\begin{align*}\n* \\operatorname{lgamma}(x) &= \\ln(|\\Gamma(x)|) \\\\\n* &= \\ln\\biggl(\\frac{\\pi}{|x \\sin(\\pi x)|}\\biggr) - \\operatorname{lgamma}(-x)\n* \\end{align*}\n* ```\n*\n* <!-- <note> -->\n*\n* Note that one should avoid computing \\\\(\\pi (-x)\\\\) directly in the computation of \\\\(\\sin(\\pi (-x))\\\\).\n*\n* <!-- </note> -->\n*\n* ## Special Cases\n*\n* ```tex\n* \\begin{align*}\n* \\operatorname{lgamma}(2+s) &\\approx s (1-\\gamma) & \\mathrm{for\\ tiny\\ s} \\\\\n* \\operatorname{lgamma}(x) &\\approx -\\ln(x) & \\mathrm{for\\ tiny\\ x} \\\\\n* \\operatorname{lgamma}(1) &= 0 & \\\\\n* \\operatorname{lgamma}(2) &= 0 & \\\\\n* \\operatorname{lgamma}(0) &= \\infty & \\\\\n* \\operatorname{lgamma}(\\infty) &= \\infty & \\\\\n* \\operatorname{lgamma}(-\\mathrm{integer}) &= \\pm \\infty\n* \\end{align*}\n* ```\n*\n* @param {number} x - input value\n* @returns {number} function value\n*\n* @example\n* var v = gammaln( 1.0 );\n* // returns 0.0\n*\n* @example\n* var v = gammaln( 2.0 );\n* // returns 0.0\n*\n* @example\n* var v = gammaln( 4.0 );\n* // returns ~1.792\n*\n* @example\n* var v = gammaln( -0.5 );\n* // returns ~1.266\n*\n* @example\n* var v = gammaln( 0.5 );\n* // returns ~0.572\n*\n* @example\n* var v = gammaln( 0.0 );\n* // returns Infinity\n*\n* @example\n* var v = gammaln( NaN );\n* // returns NaN\n*/\nfunction gammaln( x ) {\n\tvar isNegative;\n\tvar nadj;\n\tvar flg;\n\tvar p3;\n\tvar p2;\n\tvar p1;\n\tvar p;\n\tvar q;\n\tvar t;\n\tvar w;\n\tvar y;\n\tvar z;\n\tvar r;\n\n\t// Special cases: NaN, +-infinity\n\tif ( isnan( x ) || isInfinite( x ) ) {\n\t\treturn x;\n\t}\n\t// Special case: 0\n\tif ( x === 0.0 ) {\n\t\treturn PINF;\n\t}\n\tif ( x < 0.0 ) {\n\t\tisNegative = true;\n\t\tx = -x;\n\t} else {\n\t\tisNegative = false;\n\t}\n\t// If |x| < 2**-56, return -ln(|x|)\n\tif ( x < TINY ) {\n\t\treturn -ln( x );\n\t}\n\tif ( isNegative ) {\n\t\t// If |x| >= 2**52, must be -integer\n\t\tif ( x >= TWO52 ) {\n\t\t\treturn PINF;\n\t\t}\n\t\tt = sinpi( x );\n\t\tif ( t === 0.0 ) {\n\t\t\treturn PINF;\n\t\t}\n\t\tnadj = ln( PI / abs( t*x ) );\n\t}\n\t// If x equals 1 or 2, return 0\n\tif ( x === 1.0 || x === 2.0 ) {\n\t\treturn 0.0;\n\t}\n\t// If x < 2, use lgamma(x) = lgamma(x+1) - log(x)\n\tif ( x < 2.0 ) {\n\t\tif ( x <= 0.9 ) {\n\t\t\tr = -ln( x );\n\n\t\t\t// 0.7316 <= x <= 0.9\n\t\t\tif ( x >= ( YMIN - 1.0 + 0.27 ) ) {\n\t\t\t\ty = 1.0 - x;\n\t\t\t\tflg = 0;\n\t\t\t}\n\t\t\t// 0.2316 <= x < 0.7316\n\t\t\telse if ( x >= (YMIN - 1.0 - 0.27) ) {\n\t\t\t\ty = x - (TC - 1.0);\n\t\t\t\tflg = 1;\n\t\t\t}\n\t\t\t// 0 < x < 0.2316\n\t\t\telse {\n\t\t\t\ty = x;\n\t\t\t\tflg = 2;\n\t\t\t}\n\t\t} else {\n\t\t\tr = 0.0;\n\n\t\t\t// 1.7316 <= x < 2\n\t\t\tif ( x >= (YMIN + 0.27) ) {\n\t\t\t\ty = 2.0 - x;\n\t\t\t\tflg = 0;\n\t\t\t}\n\t\t\t// 1.2316 <= x < 1.7316\n\t\t\telse if ( x >= (YMIN - 0.27) ) {\n\t\t\t\ty = x - TC;\n\t\t\t\tflg = 1;\n\t\t\t}\n\t\t\t// 0.9 < x < 1.2316\n\t\t\telse {\n\t\t\t\ty = x - 1.0;\n\t\t\t\tflg = 2;\n\t\t\t}\n\t\t}\n\t\tswitch ( flg ) { // eslint-disable-line default-case\n\t\tcase 0:\n\t\t\tz = y * y;\n\t\t\tp1 = A1C + (z*polyvalA1( z ));\n\t\t\tp2 = z * (A2C + (z*polyvalA2( z )));\n\t\t\tp = (y*p1) + p2;\n\t\t\tr += ( p - (0.5*y) );\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tz = y * y;\n\t\t\tw = z * y;\n\t\t\tp1 = T1C + (w*polyvalT1( w ));\n\t\t\tp2 = T2C + (w*polyvalT2( w ));\n\t\t\tp3 = T3C + (w*polyvalT3( w ));\n\t\t\tp = (z*p1) - (TT - (w*(p2+(y*p3))));\n\t\t\tr += ( TF + p );\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tp1 = y * (UC + (y*polyvalU( y )));\n\t\t\tp2 = VC + (y*polyvalV( y ));\n\t\t\tr += (-0.5*y) + (p1/p2);\n\t\t\tbreak;\n\t\t}\n\t}\n\t// 2 <= x < 8\n\telse if ( x < 8.0 ) {\n\t\tflg = trunc( x );\n\t\ty = x - flg;\n\t\tp = y * (SC + (y*polyvalS( y )));\n\t\tq = RC + (y*polyvalR( y ));\n\t\tr = (0.5*y) + (p/q);\n\t\tz = 1.0; // gammaln(1+s) = ln(s) + gammaln(s)\n\t\tswitch ( flg ) { // eslint-disable-line default-case\n\t\tcase 7:\n\t\t\tz *= y + 6.0;\n\n\t\t\t/* Falls through */\n\t\tcase 6:\n\t\t\tz *= y + 5.0;\n\n\t\t\t/* Falls through */\n\t\tcase 5:\n\t\t\tz *= y + 4.0;\n\n\t\t\t/* Falls through */\n\t\tcase 4:\n\t\t\tz *= y + 3.0;\n\n\t\t\t/* Falls through */\n\t\tcase 3:\n\t\t\tz *= y + 2.0;\n\t\t\tr += ln( z );\n\t\t}\n\t}\n\t// 8 <= x < 2**56\n\telse if ( x < TWO56 ) {\n\t\tt = ln( x );\n\t\tz = 1.0 / x;\n\t\ty = z * z;\n\t\tw = WC + (z*polyvalW( y ));\n\t\tr = ((x-0.5)*(t-1.0)) + w;\n\t}\n\t// 2**56 <= x <= Inf\n\telse {\n\t\tr = x * ( ln(x)-1.0 );\n\t}\n\tif ( isNegative ) {\n\t\tr = nadj - r;\n\t}\n\treturn r;\n}\n\n\n// EXPORTS //\n\nmodule.exports = gammaln;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Evaluate the natural logarithm of the gamma function.\n*\n* @module @stdlib/math-base-special-gammaln\n*\n* @example\n* var gammaln = require( '@stdlib/math-base-special-gammaln' );\n*\n* var v = gammaln( 1.0 );\n* // returns 0.0\n*\n* v = gammaln( 2.0 );\n* // returns 0.0\n*\n* v = gammaln( 4.0 );\n* // returns ~1.792\n*\n* v = gammaln( -0.5 );\n* // returns ~1.266\n*\n* v = gammaln( 0.5 );\n* // returns ~0.572\n*\n* v = gammaln( 0.0 );\n* // returns Infinity\n*\n* v = gammaln( NaN );\n* // returns NaN\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAoCA,SAASC,EAAUC,EAAI,CAC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EAAKpB,GAAOwB,EAAElC,GAAWkC,CAAE,EAC3BL,EAAKlB,GAAOuB,EAAEjC,GAAWiC,CAAE,EAC3BN,EAAKhB,GAAOsB,EAAEhC,GAAWgC,CAAE,EAC3BH,EAAKK,EAAEN,GAAOR,GAAMY,GAAGL,EAAIM,EAAEP,IAC7BS,GAAOhB,GAAKU,EACZ,MACD,IAAK,GACJD,EAAKK,GAAKtB,GAAMsB,EAAEhC,GAAUgC,CAAE,GAC9BN,EAAKf,GAAMqB,EAAE/B,GAAU+B,CAAE,EACzBE,GAAM,IAAKF,EAAML,EAAGD,EACpB,KACD,SAGSL,EAAI,EAOb,OANAG,EAAMnC,GAAOgC,CAAE,EACfW,EAAIX,EAAIG,EACRI,EAAII,GAAK1B,GAAM0B,EAAEpC,GAAUoC,CAAE,GAC7BH,EAAIxB,GAAM2B,EAAErC,GAAUqC,CAAE,EACxBE,EAAK,GAAIF,EAAMJ,EAAEC,EACjBI,EAAI,EACKT,EAAM,CACf,IAAK,GACJS,GAAKD,EAAI,EAGV,IAAK,GACJC,GAAKD,EAAI,EAGV,IAAK,GACJC,GAAKD,EAAI,EAGV,IAAK,GACJC,GAAKD,EAAI,EAGV,IAAK,GACJC,GAAKD,EAAI,EACTE,GAAK9C,EAAI6C,CAAE,CACZ,MAGSZ,EAAIN,IACbe,EAAI1C,EAAIiC,CAAE,EACVY,EAAI,EAAMZ,EACVW,EAAIC,EAAIA,EACRF,EAAInB,GAAMqB,EAAE/B,GAAU8B,CAAE,EACxBE,GAAMb,EAAE,KAAMS,EAAE,GAAQC,GAIxBG,EAAIb,GAAMjC,EAAGiC,CAAC,EAAE,GAEjB,OAAKC,IACJY,EAAIX,EAAOW,GAELA,CACR,CAKAlD,EAAO,QAAUoC,KChWjB,IAAIe,GAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_polyval_a1", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_a2", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_r", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_s", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_t1", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_t2", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_t3", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_u", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_v", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_polyval_w", "__commonJSMin", "exports", "module", "evalpoly", "x", "require_main", "__commonJSMin", "exports", "module", "isnan", "isInfinite", "abs", "ln", "trunc", "sinpi", "PI", "PINF", "polyvalA1", "polyvalA2", "polyvalR", "polyvalS", "polyvalT1", "polyvalT2", "polyvalT3", "polyvalU", "polyvalV", "polyvalW", "A1C", "A2C", "RC", "SC", "T1C", "T2C", "T3C", "UC", "VC", "WC", "YMIN", "TWO52", "TWO56", "TINY", "TC", "TF", "TT", "gammaln", "x", "isNegative", "nadj", "flg", "p3", "p2", "p1", "p", "q", "t", "w", "y", "z", "r", "main"]
7
+ }