diff --git a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/benchmark.js index d27d1fa46aec..fd172205aa21 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/benchmark.js @@ -21,8 +21,9 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); var pkg = require( './../package.json' ).name; var cbrt = require( './../lib' ); @@ -37,14 +38,18 @@ var opts = { // MAIN // bench( pkg, function benchmark( b ) { - var x; + var values; var y; var i; + values = [ + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) + ]; + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = cbrt( x ); + y = cbrt( values[ i%values.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -58,14 +63,18 @@ bench( pkg, function benchmark( b ) { }); bench( pkg+'::built-in', opts, function benchmark( b ) { - var x; + var values; var y; var i; + values = [ + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) + ]; + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = Math.cbrt( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.cbrt( values[ i%values.length ]); // eslint-disable-line stdlib/no-builtin-math if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/benchmark.native.js index 84ee2255a070..3795f9537c6a 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/benchmark.native.js @@ -22,8 +22,9 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -39,14 +40,18 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var x; + var values; var y; var i; + values = [ + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) + ]; + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( 1000.0*randu() ) - 500.0; - y = cbrt( x ); + y = cbrt( values[ i%values.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/benchmark.c index 52c571cfa885..064cd97ad81e 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/benchmark.c @@ -16,6 +16,7 @@ * limitations under the License. */ +#include "stdlib/math/base/special/cbrt.h" #include #include #include @@ -89,16 +90,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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 = cbrt( x ); + y = stdlib_base_cbrt( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/cephes/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/cephes/benchmark.c index d13f55c7dd6b..1d3764d4696f 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/cephes/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/cephes/benchmark.c @@ -16,6 +16,7 @@ * limitations under the License. */ +#include "stdlib/math/base/special/cbrt.h" #include #include #include @@ -94,16 +95,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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 = cbrt( x ); + y = stdlib_base_cbrt( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/native/benchmark.c index 5be34e074428..251cdf346fd8 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cbrt/benchmark/c/native/benchmark.c @@ -90,16 +90,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; 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_cbrt( x ); + y = stdlib_base_cbrt( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cbrt/test/test.js b/lib/node_modules/@stdlib/math/base/special/cbrt/test/test.js index dbc495b4209d..2369f4a41f5f 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrt/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrt/test/test.js @@ -383,7 +383,7 @@ tape( 'the function evaluates the cubic root of `x` (huge positive)', function t tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = cbrt( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cbrt/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cbrt/test/test.native.js index 2ad7c7287007..97ad7df4c446 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrt/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrt/test/test.native.js @@ -392,7 +392,7 @@ tape( 'the function evaluates the cubic root of `x` (huge positive)', opts, func tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = cbrt( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/benchmark.js index a16a419f230a..8bba9d447da7 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/benchmark.js @@ -21,8 +21,9 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); var pkg = require( './../package.json' ).name; var cbrtf = require( './../lib' ); @@ -37,14 +38,18 @@ var opts = { // MAIN // bench( pkg, function benchmark( b ) { - var x; + var values; var y; var i; + values = [ + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) + ]; + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = cbrtf( x ); + y = cbrtf( values[ i%values.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } @@ -58,14 +63,18 @@ bench( pkg, function benchmark( b ) { }); bench( pkg+'::built-in', opts, function benchmark( b ) { - var x; + var values; var y; var i; + values = [ + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) + ]; + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*1000.0 ) - 500.0; - y = Math.cbrt( x ); // eslint-disable-line stdlib/no-builtin-math + y = Math.cbrt( values[ i%values.length ] ); // eslint-disable-line stdlib/no-builtin-math if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/benchmark.native.js index 25a01995a6a7..7c3d98dcb9d7 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/benchmark.native.js @@ -22,8 +22,9 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var Complex128 = require( '@stdlib/complex/float64/ctor' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -39,14 +40,18 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var x; + var values; var y; var i; + values = [ + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ), + new Complex128( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) ) + ]; + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( 1000.0*randu() ) - 500.0; - y = cbrtf( x ); + y = cbrtf( values[ i%values.length ] ); if ( isnanf( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/benchmark.c index d5467850a1c3..e15352f6f960 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/benchmark.c @@ -16,6 +16,7 @@ * limitations under the License. */ +#include "stdlib/math/base/special/cbrtf.h" #include #include #include @@ -89,16 +90,19 @@ static float rand_float( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + float x[ 100 ]; double elapsed; - float x; float y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0f*rand_float() ) - 500.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0f*rand_float() ) - 500.0f; - y = cbrtf( x ); + y = stdlib_base_cbrtf( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c index 62feda2919b5..3e91499bed82 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/benchmark/c/native/benchmark.c @@ -90,16 +90,19 @@ static float rand_float( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + float x[ 100 ]; double elapsed; - float x; float y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( 1000.0f*rand_float() ) - 500.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( 1000.0f*rand_float() ) - 500.0f; - y = stdlib_base_cbrtf( x ); + y = stdlib_base_cbrtf( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.js b/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.js index e433bb55acf4..dafbe4ba37e2 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.js @@ -383,7 +383,7 @@ tape( 'the function evaluates the cubic root of `x` (huge positive)', function t tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = cbrtf( NaN ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.native.js index 169b9af7e5a3..172dc86fc35e 100644 --- a/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/cbrtf/test/test.native.js @@ -392,7 +392,7 @@ tape( 'the function evaluates the cubic root of `x` (huge positive)', opts, func tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var v = cbrtf( NaN ); - t.equal( isnanf( v ), true, 'returns NaN' ); + t.equal( isnanf( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/cceilf/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cceilf/benchmark/c/native/benchmark.c index 2ea360db1d8b..49a925329333 100644 --- a/lib/node_modules/@stdlib/math/base/special/cceilf/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cceilf/benchmark/c/native/benchmark.c @@ -93,15 +93,18 @@ static float rand_float( void ) { static double benchmark( void ) { float complex x; float complex y; + float v[ 100 ]; double elapsed; double t; - float v; int i; + for ( i = 0; i < 100; i++ ) { + v[ i ] = ( 1000.0f*rand_float() ) - 500.0f; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - v = ( 1000.0f*rand_float() ) - 500.0f; - x = v + v*I; + x = v[ i%100 ] + v[ i%100 ]*I; y = stdlib_base_cceilf( x ); if ( crealf( y ) != crealf( y ) ) { printf( "unexpected result\n" ); diff --git a/lib/node_modules/@stdlib/math/base/special/cceiln/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/cceiln/benchmark/c/benchmark.c index 16cd3a5a1325..a1b19ae69351 100644 --- a/lib/node_modules/@stdlib/math/base/special/cceiln/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/cceiln/benchmark/c/benchmark.c @@ -93,15 +93,18 @@ static double rand_double( void ) { static double benchmark( void ) { double complex x; double complex y; + double v[ 100 ]; double elapsed; double t; - double v; int i; + for ( i = 0; i < 100; i++ ) { + v[ i ] = ( 1000.0 * rand_double() ) - 500.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - v = ( 1000.0*rand_double() ) - 500.0; - x = v + v*I; + x = v[ i%100 ] + v[ i%100 ]*I; y = stdlib_base_ceiln( creal( x ), -2 ) + stdlib_base_ceiln( cimag( x ), -2 )*I; if ( creal( y ) != creal( y ) ) { printf( "unexpected result\n" );