From ce32bbd8046a63c0f86e65163c886a440bb4d163 Mon Sep 17 00:00:00 2001 From: hrshya <harshyadav6078@gmail.com> Date: Mon, 24 Mar 2025 22:12:11 +0530 Subject: [PATCH] bench: update random value generation --- .../special/gammainc/benchmark/benchmark.js | 51 +++++++++++-------- .../gammainc/benchmark/c/cephes/benchmark.c | 26 ++++++---- .../math/base/special/gammainc/test/test.js | 12 ++--- .../gammaincinv/benchmark/benchmark.js | 9 ++-- .../benchmark/c/cephes/benchmark.c | 13 +++-- .../base/special/gammaincinv/test/test.js | 16 +++--- .../special/gammaln/benchmark/benchmark.js | 7 +-- .../gammaln/benchmark/benchmark.native.js | 7 +-- .../special/gammaln/benchmark/c/benchmark.c | 9 ++-- .../gammaln/benchmark/c/cephes/benchmark.c | 9 ++-- .../gammaln/benchmark/c/native/benchmark.c | 9 ++-- .../math/base/special/gammaln/test/test.js | 14 ++--- .../base/special/gammaln/test/test.native.js | 14 ++--- 13 files changed, 112 insertions(+), 84 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/gammainc/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/gammainc/benchmark/benchmark.js index 84a867ba14f0..1d9fb82bc25b 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammainc/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/gammainc/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -36,11 +36,12 @@ bench( pkg, function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, EPS, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) + EPS; - z = gammainc( x, y ); + z = gammainc( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } @@ -59,11 +60,12 @@ bench( pkg+':regularized=true', function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, EPS, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) + EPS; - z = gammainc( x, y, true ); + z = gammainc( x[ i%x.length ], y[ i%y.length ], true ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } @@ -82,11 +84,12 @@ bench( pkg+':regularized=false', function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, EPS, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) + EPS; - z = gammainc( x, y, false ); + z = gammainc( x[ i%x.length ], y[ i%y.length ], false ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } @@ -105,11 +108,12 @@ bench( pkg+':regularized=true,upper=true', function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, EPS, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) + EPS; - z = gammainc( x, y, true, true ); + z = gammainc( x[ i%x.length ], y[ i%y.length ], true, true ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } @@ -128,11 +132,12 @@ bench( pkg+':regularized=true,upper=false', function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, EPS, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) + EPS; - z = gammainc( x, y, true, false ); + z = gammainc( x[ i%x.length ], y[ i%y.length ], true, false ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } @@ -151,11 +156,12 @@ bench( pkg+':regularized=false,upper=true', function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, EPS, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) + EPS; - z = gammainc( x, y, false, true ); + z = gammainc( x[ i%x.length ], y[ i%y.length ], false, true ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } @@ -174,11 +180,12 @@ bench( pkg+':regularized=false,upper=false', function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1000.0 ); + y = uniform( 100, EPS, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 0.0; - y = ( randu()*1000.0 ) + EPS; - z = gammainc( x, y, false, false ); + z = gammainc( x[ i%x.length ], y[ i%y.length ], false, false ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/gammainc/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/gammainc/benchmark/c/cephes/benchmark.c index 8ae28d095a5a..934ce38adcb8 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammainc/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/gammainc/benchmark/c/cephes/benchmark.c @@ -96,17 +96,20 @@ static double rand_double( void ) { */ static double benchmark1( void ) { double elapsed; - double x; - double y; + double x[ 100 ]; + double y[ 100 ]; double z; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0*rand_double() ) - 0.0; + y[ i ] = ( 99.9*rand_double() ) + 0.1; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 0.0; - y = ( 99.9*rand_double() ) + 0.1; - z = igam( x, y ); + z = igam( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; @@ -126,17 +129,20 @@ static double benchmark1( void ) { */ static double benchmark2( void ) { double elapsed; - double x; - double y; + double x[ 100 ]; + double y[ 100 ]; double z; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 100.0*rand_double() ) - 0.0; + y[ i ] = ( 99.9*rand_double() ) + 0.1; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 100.0*rand_double() ) - 0.0; - y = ( 99.9*rand_double() ) + 0.1; - z = igamc( x, y ); + z = igamc( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/gammainc/test/test.js b/lib/node_modules/@stdlib/math/base/special/gammainc/test/test.js index 09f8f6978307..72bb25ecbe5a 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammainc/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/gammainc/test/test.js @@ -51,10 +51,10 @@ tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var val; val = gammainc( NaN, 2 ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); val = gammainc( 4, NaN ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); t.end(); }); @@ -64,15 +64,15 @@ tape( 'the function returns NaN if provided x < 0 or s <= 0', function test( t ) // Case: x < 0 val = gammainc( -0.1, 2 ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); // Case: s = 0 val = gammainc( 0.1, 0 ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); // Case: s < 0 val = gammainc( 0.1, -2 ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); t.end(); }); @@ -82,7 +82,7 @@ tape( 'the function returns 0 for the lower incomplete gamma function when the f var s; for ( s = 1; s < 10; s++ ) { val = gammainc( 0, s ); - t.ok( val === 0, 'returns 0' ); + t.ok( val === 0, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaincinv/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/gammaincinv/benchmark/benchmark.js index 393505f591df..34f6b30a9622 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaincinv/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/gammaincinv/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var gammaincinv = require( './../lib' ); @@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) { var z; var i; + x = uniform( 100, 0.0, 1.0 ); + y = uniform( 100, 0.1, 1000.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu(); - y = ( randu()*1000.0 ) + 0.1; - z = gammaincinv( x, y ); + z = gammaincinv( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/gammaincinv/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/gammaincinv/benchmark/c/cephes/benchmark.c index 760b0871a8c3..1d1684bcbc0d 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaincinv/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/gammaincinv/benchmark/c/cephes/benchmark.c @@ -95,17 +95,20 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; - double y; + double x[ 100 ]; + double y[ 100 ]; double z; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0*rand_double() ) + 0.1; + y[ i ] = ( 0.5*rand_double() ); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) + 0.1; - y = ( 0.5*rand_double() ); - z = igami( x, y ); + z = igami( x[ i%100 ], y[ i%100 ] ); if ( z != z ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaincinv/test/test.js b/lib/node_modules/@stdlib/math/base/special/gammaincinv/test/test.js index 7480c78f9ab2..98aca670d193 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaincinv/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/gammaincinv/test/test.js @@ -96,10 +96,10 @@ tape( 'the function returns `NaN` if provided a `NaN`', function test( t ) { var val; val = gammaincinv( NaN, 2 ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); val = gammaincinv( 0.5, NaN ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); t.end(); }); @@ -108,10 +108,10 @@ tape( 'the function returns `NaN` if provided `p` outside the interval `[0,1]`', var val; val = gammaincinv( 1.2, 2 ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); val = gammaincinv( -0.1, 2 ); - t.strictEqual( isnan( val ), true, 'returns NaN' ); + t.strictEqual( isnan( val ), true, 'returns expected value' ); t.end(); }); @@ -124,7 +124,7 @@ tape( 'the function returns `0` if provided `p = 1`', function test( t ) { a = incrspace( 0, 100, 10 ); for ( i = 0; i < a.length; i++ ) { val = gammaincinv( 1, a[ i ] ); - t.notOk( val === 0, 'returns 0' ); + t.notOk( val === 0, 'returns expected value' ); } t.end(); }); @@ -137,7 +137,7 @@ tape( 'the function returns `+Infinity` if provided `p = 0`', function test( t ) a = incrspace( 0, 100, 10 ); for ( i = 0; i < a.length; i++ ) { val = gammaincinv( 0, a[ i ] ); - t.notOk( val === PINF, 'returns +Infinity' ); + t.notOk( val === PINF, 'returns expected value' ); } t.end(); }); @@ -150,7 +150,7 @@ tape( 'the function returns `0` if provided `p = 0` when `upper = true`', functi a = incrspace( 0, 100, 10 ); for ( i = 0; i < a.length; i++ ) { val = gammaincinv( 0, a[ i ], true ); - t.notOk( val === 0, 'returns 0' ); + t.notOk( val === 0, 'returns expected value' ); } t.end(); }); @@ -163,7 +163,7 @@ tape( 'the function returns `+Infinity` if provided `p = 1` when `upper = true`' a = incrspace( 0, 100, 10 ); for ( i = 0; i < a.length; i++ ) { val = gammaincinv( 1, a[ i ], true ); - t.notOk( val === PINF, 'returns +Infinity' ); + t.notOk( val === PINF, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.js index f050e865180b..c85cb24376d9 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var gammaln = require( './../lib' ); @@ -34,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = uniform( 100, -500.0, 500.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = gammaln( x ); + y = gammaln( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.native.js index fbf95371780d..beaecf7e12ec 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -43,10 +43,11 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = uniform( 100, -500.0, 500.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 1000.0 ) - 500.0; - y = gammaln( x ); + y = gammaln( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/benchmark.c index cafe1c4ea363..f7c04b9c24df 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/benchmark.c @@ -90,15 +90,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 500.0; - y = lgamma( x ); + y = lgamma( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/benchmark.c index 4be0ef871a67..8b568a095a25 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/cephes/benchmark.c @@ -95,15 +95,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0*rand_double() ) - 500.0; - y = lgam( x ); + y = lgam( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/benchmark.c index ec0342a3aae3..fa823e29fbb3 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/gammaln/benchmark/c/native/benchmark.c @@ -91,15 +91,18 @@ static double rand_double( void ) { */ static double benchmark( void ) { double elapsed; - double x; + double x[ 100 ]; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0*rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0 * rand_double() ) - 500.0; - y = stdlib_base_gammaln( x ); + y = stdlib_base_gammaln( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.js b/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.js index d13eb26dbaab..c31b8b463d67 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.js @@ -49,29 +49,29 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN`, the function returns `NaN`', function test( t ) { var v = gammaln( NaN ); - t.equal( isnan( v ), true, 'returns NaN when provided a NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `infinity` when provided `infinity`', function test( t ) { var v = gammaln( PINF ); - t.equal( v, PINF, 'returns +Inf when provided +Inf' ); + t.equal( v, PINF, 'returns expected value' ); v = gammaln( NINF ); - t.equal( v, NINF, 'returns -Inf when provided -Inf' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` when provided `0`', function test( t ) { var v = gammaln( 0.0 ); - t.equal( v, PINF, 'returns +Inf when provided 0' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` for x smaller than `-2^52`', function test( t ) { var v = gammaln( -pow( 2.0, 53 ) ); - t.equal( v, PINF, 'returns +Inf when provided 2^53' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); @@ -81,7 +81,7 @@ tape( 'the function returns `-ln(x)` for very small x', function test( t ) { x = 2.0e-90; v = gammaln( x ); - t.equal( v, -ln( x ), 'equals -ln(x)' ); + t.equal( v, -ln( x ), 'returns expected value' ); t.end(); }); @@ -154,6 +154,6 @@ tape( 'if provided a positive integer, the function returns the natural logarith tape( 'returns `+infinity` for `x=-2^51`', function test( t ) { var v = gammaln( -pow( 2.0, 51 ) ); - t.equal( v, PINF, 'returns +Infinity when provided x=-2^51' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.native.js index f299c0cfa361..27fa9255481a 100644 --- a/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/gammaln/test/test.native.js @@ -58,29 +58,29 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t ) { var v = gammaln( NaN ); - t.equal( isnan( v ), true, 'returns expected value when provided a NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'the function returns `infinity` when provided `infinity`', opts, function test( t ) { var v = gammaln( PINF ); - t.equal( v, PINF, 'returns +Inf when provided +Inf' ); + t.equal( v, PINF, 'returns expected value' ); v = gammaln( NINF ); - t.equal( v, NINF, 'returns -Inf when provided -Inf' ); + t.equal( v, NINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` when provided `0`', opts, function test( t ) { var v = gammaln( 0.0 ); - t.equal( v, PINF, 'returns +Inf when provided 0' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); tape( 'the function returns `+infinity` for x smaller than `-2^52`', opts, function test( t ) { var v = gammaln( -pow( 2.0, 53 ) ); - t.equal( v, PINF, 'returns +Inf when provided 2^53' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); }); @@ -90,7 +90,7 @@ tape( 'the function returns `-ln(x)` for very small x', opts, function test( t ) x = 2.0e-90; v = gammaln( x ); - t.equal( v, -ln( x ), 'equals -ln(x)' ); + t.equal( v, -ln( x ), 'returns expected value' ); t.end(); }); @@ -163,6 +163,6 @@ tape( 'if provided a positive integer, the function returns the natural logarith tape( 'returns `+infinity` for `x=-2^51`', opts, function test( t ) { var v = gammaln( -pow( 2.0, 51 ) ); - t.equal( v, PINF, 'returns +Infinity when provided x=-2^51' ); + t.equal( v, PINF, 'returns expected value' ); t.end(); });