diff --git a/lib/node_modules/@stdlib/math/base/special/asind/README.md b/lib/node_modules/@stdlib/math/base/special/asind/README.md index 08f4ffc2f1fd..79f9cb91d479 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/README.md +++ b/lib/node_modules/@stdlib/math/base/special/asind/README.md @@ -20,7 +20,7 @@ limitations under the License. # asind -> Compute the [arcsine][arcsine] in degrees of a double-precision floating-point number. +> Compute the [arcsine][arcsine] (in degrees) of a double-precision floating-point number.
@@ -36,6 +36,7 @@ Computes the [arcsine][arcsine] (in degrees) of a double-precision floating-poin ```javascript var sqrt = require( '@stdlib/math/base/special/sqrt' ); + var v = asind( 0.0 ); // returns 0.0 @@ -154,7 +155,7 @@ double stdlib_base_asind( const double x ); #include int main( void ) { - const double x[] = { 1.0, 1.45, 1.89, 2.33, 2.78, 3.22, 3.66, 4.11, 4.55, 5.0 }; + const double x[] = { 1.0, 0.45, -0.89, 0.33, -0.78, -0.22, 0.66, 0.11, -0.55, 0.0 }; double v; int i; diff --git a/lib/node_modules/@stdlib/math/base/special/asind/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/asind/benchmark/benchmark.js index 327a06aadaff..ddf5f9f9ef05 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/asind/benchmark/benchmark.js @@ -36,7 +36,7 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*2.0 ) - 1.0; + x = ( randu() * 2.0 ) - 1.0; y = asind( x ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/math/base/special/asind/docs/repl.txt b/lib/node_modules/@stdlib/math/base/special/asind/docs/repl.txt index 014e881c4a11..5826dc118fe4 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/docs/repl.txt +++ b/lib/node_modules/@stdlib/math/base/special/asind/docs/repl.txt @@ -19,7 +19,7 @@ -------- > var y = {{alias}}( 0.0 ) 0.0 - > y = {{alias}}( {{alias:@stdlib/constants/float64/pi}}/6.0 ) + > y = {{alias}}( {{alias:@stdlib/constants/float64/pi}} / 6.0 ) ~31.57 > y = {{alias}}( NaN ) NaN diff --git a/lib/node_modules/@stdlib/math/base/special/asind/docs/types/index.d.ts b/lib/node_modules/@stdlib/math/base/special/asind/docs/types/index.d.ts index c5314293fd89..a987ef1ec72a 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/math/base/special/asind/docs/types/index.d.ts @@ -33,11 +33,15 @@ * // returns ~30.0 * * @example -* var v = asind( Math.sqrt( 2.0 ) / 2.0 ); +* var sqrt = require( '@stdlib/math/base/special/sqrt' ); +* +* var v = asindf( sqrt( 2.0 ) / 2.0 ); * // returns ~45.0 * * @example -* var v = asind( Math.sqrt( 3.0 ) / 2.0 ); +* var sqrt = require( '@stdlib/math/base/special/sqrt' ); +* +** var v = asindf( sqrt( 3.0 ) / 2.0 ); * // returns ~60.0 * * @example diff --git a/lib/node_modules/@stdlib/math/base/special/asind/examples/c/example.c b/lib/node_modules/@stdlib/math/base/special/asind/examples/c/example.c index 46bdb73836ca..73fa39694b48 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/examples/c/example.c +++ b/lib/node_modules/@stdlib/math/base/special/asind/examples/c/example.c @@ -20,7 +20,7 @@ #include int main( void ) { - const double x[] = { 1.0, 1.45, 1.89, 2.33, 2.78, 3.22, 3.66, 4.11, 4.55, 5.0 }; + const double x[] = { 1.0, 0.45, -0.89, 0.33, -0.78, -0.22, 0.66, 0.11, -0.55, 0.0 }; double v; int i; diff --git a/lib/node_modules/@stdlib/math/base/special/asind/lib/index.js b/lib/node_modules/@stdlib/math/base/special/asind/lib/index.js index ed7549c4eb1c..3f6ef2f4aa04 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/lib/index.js +++ b/lib/node_modules/@stdlib/math/base/special/asind/lib/index.js @@ -24,6 +24,7 @@ * @module @stdlib/math/base/special/asind * * @example +* var sqrt = require( '@stdlib/math/base/special/sqrt' ); * var asind = require( '@stdlib/math/base/special/asind' ); * * var v = asind( 0.0 ); @@ -32,10 +33,10 @@ * var v = asind( 0.5 ); * // returns ~30.0 * -* var v = asind( Math.sqrt( 2.0 ) / 2.0 ); +* var v = asind( sqrt( 2.0 ) / 2.0 ); * // returns ~45.0 * -* var v = asind( Math.sqrt( 3.0 ) / 2.0 ); +* var v = asind( sqrt( 3.0 ) / 2.0 ); * // returns ~60.0 * * var v = asind( NaN ); diff --git a/lib/node_modules/@stdlib/math/base/special/asind/lib/main.js b/lib/node_modules/@stdlib/math/base/special/asind/lib/main.js index fe1b27541afb..b35f64abb3f6 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/asind/lib/main.js @@ -41,11 +41,15 @@ var asin = require( '@stdlib/math/base/special/asin' ); * // returns ~30.0 * * @example -* var v = asind( Math.sqrt( 2.0 ) / 2.0 ); +* var sqrt = require( '@stdlib/math/base/special/sqrt' ); +* +* var v = asind( sqrt( 2.0 ) / 2.0 ); * // returns ~45.0 * * @example -* var v = asind( Math.sqrt( 3.0 ) / 2.0 ); +* var sqrt = require( '@stdlib/math/base/special/sqrt' ); +* +* var v = asind( sqrt( 3.0 ) / 2.0 ); * // returns ~60.0 * * @example @@ -53,8 +57,7 @@ var asin = require( '@stdlib/math/base/special/asin' ); * // returns NaN */ function asind( x ) { - var rad = asin( x ); - return rad2deg( rad ); + return rad2deg( asin( x ) ); } diff --git a/lib/node_modules/@stdlib/math/base/special/asind/lib/native.js b/lib/node_modules/@stdlib/math/base/special/asind/lib/native.js index 9e1b0a9cc9f4..bcfcbfd4040e 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/lib/native.js +++ b/lib/node_modules/@stdlib/math/base/special/asind/lib/native.js @@ -28,6 +28,7 @@ var addon = require( './../src/addon.node' ); /** * Computes the arcsine (in degrees) of a double-precision floating-point number. * +* @private * @param {number} x - input value * @returns {number} arcsine (in degrees) * @@ -40,11 +41,15 @@ var addon = require( './../src/addon.node' ); * // returns ~30.0 * * @example -* var v = asind( Math.sqrt( 2.0 ) / 2.0 ); +* var sqrt = require( '@stdlib/math/base/special/sqrt' ); +* +* var v = asind( sqrt( 2.0 ) / 2.0 ); * // returns ~45.0 * * @example -* var v = asind( Math.sqrt( 3.0 ) / 2.0 ); +* var sqrt = require( '@stdlib/math/base/special/sqrt' ); +* +* var v = asind( sqrt( 3.0 ) / 2.0 ); * // returns ~60.0 * * @example diff --git a/lib/node_modules/@stdlib/math/base/special/asind/src/main.c b/lib/node_modules/@stdlib/math/base/special/asind/src/main.c index 52c1b6e4752a..13706247e2e5 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/asind/src/main.c @@ -27,12 +27,9 @@ * @return arcsine (in degrees) * * @example -* double v = stdlib_base_acotd( 0.0 ); +* double v = stdlib_base_asind( 0.0 ); * // returns 0.0 */ double stdlib_base_asind( const double x ) { - double rad; - - rad = stdlib_base_asin( x ); - return stdlib_base_rad2deg( rad ); + return stdlib_base_rad2deg( stdlib_base_asin( x ) ); } diff --git a/lib/node_modules/@stdlib/math/base/special/asind/test/test.js b/lib/node_modules/@stdlib/math/base/special/asind/test/test.js index 3035bd99d1f0..795ea96e1175 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/asind/test/test.js @@ -22,7 +22,7 @@ var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var abs = require( '@stdlib/math/base/special/abs' ); var EPS = require( '@stdlib/constants/float64/eps' ); var asind = require( './../lib' ); @@ -54,13 +54,13 @@ tape( 'the function computes the arcsine in degrees (negative values)', function expected = negative.expected; for ( i = 0; i < x.length; i++ ) { - y = asind( x[i] ); + y = asind( x[ i ] ); if ( y === expected[ i ] ) { - t.equal( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); + t.equal( y, expected[ i ], 'x: '+x[ i ]+'. E: '+expected[ i ] ); } else { - delta = abs( y - expected[i] ); - tol = 1.4 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); + delta = abs( y - expected[ i ] ); + tol = 1.2 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+expected[ i ]+'. tol: '+tol+'. Δ: '+delta+'.' ); } } t.end(); @@ -78,13 +78,13 @@ tape( 'the function computes the arcsine in degrees (positive values)', function expected = positive.expected; for ( i = 0; i < x.length; i++ ) { - y = asind( x[i] ); + y = asind( x[ i ] ); if ( y === expected[ i ] ) { - t.equal( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); + t.equal( y, expected[ i ], 'x: '+x[ i ]+'. E: '+expected[ i ] ); } else { - delta = abs( y - expected[i] ); - tol = 1.4 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); + delta = abs( y - expected[ i ] ); + tol = 1.2 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+expected[ i ]+'. tol: '+tol+'. Δ: '+delta+'.' ); } } t.end(); @@ -92,7 +92,7 @@ tape( 'the function computes the arcsine in degrees (positive values)', function tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var v = asind( NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -101,8 +101,8 @@ tape( 'the function returns `NaN` if provided a value less than `-1`', function var i; for ( i = 0; i < 1e3; i++ ) { - v = -(randu()*1.0e6) - (1.0-EPS); - t.equal( isnan( asind( v ) ), true, 'returns NaN when provided '+v ); + v = uniform( -1.0e6, -1.0 - EPS ); + t.equal( isnan( asind( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); @@ -112,8 +112,8 @@ tape( 'the function returns `NaN` if provided a value greater than `+1`', functi var i; for ( i = 0; i < 1e3; i++ ) { - v = (randu()*1.0e6) + 1.0 + EPS; - t.equal( isnan( asind( v ) ), true, 'returns NaN when provided '+v ); + v = uniform( 1.0 + EPS, 1.0e6 ); + t.equal( isnan( asind( v ) ), true, 'returns expected value when provided '+v ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/asind/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/asind/test/test.native.js index 2208e76eb923..566037b546b5 100644 --- a/lib/node_modules/@stdlib/math/base/special/asind/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/asind/test/test.native.js @@ -23,7 +23,7 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var abs = require( '@stdlib/math/base/special/abs' ); var EPS = require( '@stdlib/constants/float64/eps' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -63,13 +63,13 @@ tape( 'the function computes the arcsine in degrees (negative values)', opts, fu expected = negative.expected; for ( i = 0; i < x.length; i++ ) { - y = asind( x[i] ); + y = asind( x[ i ] ); if ( y === expected[ i ] ) { - t.equal( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); + t.equal( y, expected[ i ], 'x: '+x[ i ]+'. E: '+expected[ i ] ); } else { - delta = abs( y - expected[i] ); - tol = 1.4 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); + delta = abs( y - expected[ i ] ); + tol = 1.2 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+expected[ i ]+'. tol: '+tol+'. Δ: '+delta+'.' ); } } t.end(); @@ -87,13 +87,13 @@ tape( 'the function computes the arcsine in degrees (positive values)', opts, fu expected = positive.expected; for ( i = 0; i < x.length; i++ ) { - y = asind( x[i] ); + y = asind( x[ i ] ); if ( y === expected[ i ] ) { - t.equal( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); + t.equal( y, expected[ i ], 'x: '+x[ i ]+'. E: '+expected[ i ] ); } else { - delta = abs( y - expected[i] ); - tol = 1.4 * EPS * abs( expected[i] ); - t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); + delta = abs( y - expected[ i ] ); + tol = 1.2 * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. y: '+y+'. E: '+expected[ i ]+'. tol: '+tol+'. Δ: '+delta+'.' ); } } t.end(); @@ -110,7 +110,7 @@ tape( 'the function returns `NaN` if provided a value less than `-1`', opts, fun var i; for ( i = 0; i < 1e3; i++ ) { - v = -(randu()*1.0e6) - (1.0-EPS); + v = uniform( -1.0e6, -1.0 - EPS ); t.equal( isnan( asind( v ) ), true, 'returns NaN when provided '+v ); } t.end(); @@ -121,7 +121,7 @@ tape( 'the function returns `NaN` if provided a value greater than `+1`', opts, var i; for ( i = 0; i < 1e3; i++ ) { - v = (randu()*1.0e6) + 1.0 + EPS; + v = uniform( 1.0 + EPS, 1.0e6 ); t.equal( isnan( asind( v ) ), true, 'returns NaN when provided '+v ); } t.end();