Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/
function tgammaILargeXSeries( a1, x1 ) {
var result = 1.0;
var a = a1;
var a = a1 - 1.0;
var x = x1;
return next;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ static double sumSeries3( const double a, const double x ) {
double sum;
double ac;

ac = a;
ac = a - 1.0;
sum = 0.0;
result = 1.0;
counter = MAX_ITERATIONS;
Expand Down
12 changes: 12 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/gammainc/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,15 @@ tape( 'the function correctly evaluates the unregularized upper incomplete gamma
}
t.end();
});

tape( 'the function correctly evaluates the regularized incomplete gamma functions for large `x` when `s` is close to `x`', function test( t ) {
var actual;

// NOTE: expected values were computed using arbitrary-precision arithmetic with 60 digits of precision.
actual = gammainc( 1367.3436948118986, 1409.203708740708 );
t.strictEqual( ulpdiff( actual, 0.13190499189857088 ) <= 100, true, 'returns expected value within 100 ulp' );

actual = gammainc( 1001.0, 1000.5, true, true );
t.strictEqual( ulpdiff( actual, 0.48949191460024505 ) <= 10, true, 'returns expected value within 10 ulp' );
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,15 @@ tape( 'the function correctly evaluates the unregularized upper incomplete gamma
}
t.end();
});

tape( 'the function correctly evaluates the regularized incomplete gamma functions for large `x` when `s` is close to `x`', opts, function test( t ) {
var actual;

// NOTE: expected values were computed using arbitrary-precision arithmetic with 60 digits of precision.
actual = gammainc( 1367.3436948118986, 1409.203708740708, true, false );
t.strictEqual( ulpdiff( actual, 0.13190499189857088 ) <= 100, true, 'returns expected value within 100 ulp' );

actual = gammainc( 1001.0, 1000.5, true, true );
t.strictEqual( ulpdiff( actual, 0.48949191460024505 ) <= 10, true, 'returns expected value within 10 ulp' );
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,12 @@ tape( 'the function evaluates the cdf for `x` given degrees of freedom `k`', fun
}
t.end();
});

tape( 'the function evaluates the cdf for large `k` when `x` is close to `k`', function test( t ) {
var y;

// NOTE: expected value was computed using arbitrary-precision arithmetic with 60 digits of precision.
y = cdf( 2500.0, 2400.0 );
t.strictEqual( isAlmostSameValue( y, 0.9241270884571916, 10 ), true, 'returns expected value' );
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,12 @@ tape( 'the function evaluates the cdf for `x` given `k`', opts, function test( t
}
t.end();
});

tape( 'the function evaluates the cdf for large `k` when `x` is close to `k`', opts, function test( t ) {
var y;

// NOTE: expected value was computed using arbitrary-precision arithmetic with 60 digits of precision.
y = cdf( 2500.0, 2400.0 );
t.strictEqual( isAlmostSameValue( y, 0.9241270884571916, 10 ), true, 'returns expected value' );
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,12 @@ tape( 'the function evaluates the cdf for `x` given large parameter `lambda`', f
}
t.end();
});

tape( 'the function evaluates the cdf for large `lambda` when `x` is close to `lambda`', function test( t ) {
var y;

// NOTE: expected value was computed using arbitrary-precision arithmetic with 60 digits of precision.
y = cdf( 999.0, 1001.0 );
t.strictEqual( isAlmostSameValue( y, 0.4831885470702138, 30 ), true, 'returns expected value' );
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,12 @@ tape( 'the function evaluates the cdf for `x` given large parameter `lambda`', o
}
t.end();
});

tape( 'the function evaluates the cdf for large `lambda` when `x` is close to `lambda`', opts, function test( t ) {
var y;

// NOTE: expected value was computed using arbitrary-precision arithmetic with 60 digits of precision.
y = cdf( 999.0, 1001.0 );
t.strictEqual( isAlmostSameValue( y, 0.4831885470702138, 30 ), true, 'returns expected value' );
t.end();
});
Loading