You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Licensed under the Apache License, Version 2.0 (the "License");
216
+
* you may not use this file except in compliance with the License.
217
+
* You may obtain a copy of the License at
218
+
*
219
+
* http://www.apache.org/licenses/LICENSE-2.0
220
+
*
221
+
* Unless required by applicable law or agreed to in writing, software
222
+
* distributed under the License is distributed on an "AS IS" BASIS,
223
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
+
* See the License for the specific language governing permissions and
225
+
* limitations under the License.
226
+
*
227
+
*
228
+
* ## Notice
229
+
*
230
+
* The original C++ code and copyright notice are from the [Boost library]{@link http://www.boost.org/doc/libs/1_37_0/boost/math/special_functions/gamma.hpp}. The implementation has been modified for JavaScript.
231
+
*
232
+
* ```text
233
+
* (C) Copyright John Maddock 2006.
234
+
* (C) Copyright Paul A. Bristow 2007.
235
+
*
236
+
* Use, modification and distribution are subject to the
237
+
* Boost Software License, Version 1.0. (See accompanying file
238
+
* LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
239
+
* ```
240
+
*/
241
+
242
+
'use strict';
243
+
244
+
// MODULES //
245
+
246
+
var exp = require( '@stdlib/math/base/special/exp' );
247
+
248
+
249
+
// MAIN //
250
+
251
+
/**
252
+
* Calculates normalized Q when a is an integer.
253
+
*
254
+
* @private
255
+
* @param {integer} a - function parameter
256
+
* @param {number} x - function parameter
257
+
* @returns {number} upper gamma fraction
258
+
*/
259
+
<spanclass="cstat-no" title="statement not covered" ><spanclass="fstat-no" title="function not covered" >function finiteGammaQ( a, x ) {</span></span>
260
+
<spanclass="cstat-no" title="statement not covered" > var term;</span>
261
+
<spanclass="cstat-no" title="statement not covered" > var sum;</span>
262
+
<spanclass="cstat-no" title="statement not covered" > var e;</span>
263
+
<spanclass="cstat-no" title="statement not covered" > var n;</span>
264
+
<spanclass="cstat-no" title="statement not covered" ></span>
265
+
<spanclass="cstat-no" title="statement not covered" > e = exp( -x );</span>
266
+
<spanclass="cstat-no" title="statement not covered" > sum = e;</span>
267
+
<spanclass="cstat-no" title="statement not covered" > if ( sum !== 0.0 ) {</span>
268
+
<spanclass="cstat-no" title="statement not covered" > term = sum;</span>
269
+
<spanclass="cstat-no" title="statement not covered" > for ( n = 1; n < a; ++n ) {</span>
270
+
<spanclass="cstat-no" title="statement not covered" > term /= n;</span>
271
+
<spanclass="cstat-no" title="statement not covered" > term *= x;</span>
272
+
<spanclass="cstat-no" title="statement not covered" > sum += term;</span>
273
+
<spanclass="cstat-no" title="statement not covered" > }</span>
274
+
<spanclass="cstat-no" title="statement not covered" > }</span>
275
+
<spanclass="cstat-no" title="statement not covered" > return sum;</span>
276
+
<spanclass="cstat-no" title="statement not covered" >}</span>
277
+
278
+
279
+
// EXPORTS //
280
+
281
+
module.exports = finiteGammaQ;
282
+
</pre></td></tr></table></pre>
283
+
284
+
<divclass='push'></div><!-- for sticky footer -->
285
+
</div><!-- /wrapper -->
286
+
<divclass='footer quiet pad2 space-top1 center small'>
0 commit comments