diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js b/lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js index 130200dad97..2025ded08a6 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js @@ -27,6 +27,12 @@ var real = require( '@stdlib/complex/real' ); var imag = require( '@stdlib/complex/imag' ); +// VARIABLES // + +// Pre-allocate workspace array: +var WORKSPACE = [ 0.0, 0.0 ]; + + // MAIN // /** @@ -41,16 +47,16 @@ var imag = require( '@stdlib/complex/imag' ); * var imag = require( '@stdlib/complex/imag' ); * * var z = new Complex128( 0.0, 0.0 ); -* // returns +* // throws { 're': 0, 'im': 0 } * * var out = ccis( z ); -* // returns +* // throws * * var re = real( out ); -* // returns 1.0 +* // throws * * var im = imag( out ); -* // returns 0.0 +* // throws * * @example * var Complex128 = require( '@stdlib/complex/float64' ); @@ -58,16 +64,16 @@ var imag = require( '@stdlib/complex/imag' ); * var imag = require( '@stdlib/complex/imag' ); * * var z = new Complex128( 1.0, 0.0 ); -* // returns +* // throws { 're': 1, 'im': 0 } * * var out = ccis( z ); -* // returns +* // throws * * var re = real( out ); -* // returns ~0.540 +* // throws * * var im = imag( out ); -* // returns ~0.841 +* // throws */ function ccis( z ) { var out; @@ -79,16 +85,14 @@ function ccis( z ) { re = real( z ); im = imag( z ); - out = [ 0.0, 0.0 ]; - sincos( re, out, 1, 0 ); + sincos( re, WORKSPACE, 1, 0 ); tmp = out[ 0 ]; if ( im !== 0.0 ) { e = exp( -im ); tmp *= e; out[ 1 ] *= e; } - out[ 0 ] = out[ 1 ]; - return new Complex128( out[ 0 ], tmp ); + return new Complex128( out[ 1 ], tmp ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/src/main.c b/lib/node_modules/@stdlib/math/base/special/ccis/src/main.c index 03ef7450a64..a1809195e30 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/src/main.c +++ b/lib/node_modules/@stdlib/math/base/special/ccis/src/main.c @@ -77,6 +77,5 @@ stdlib_complex128_t stdlib_base_ccis( const stdlib_complex128_t z ) { tmp *= e; x *= e; } - y = x; - return stdlib_complex128( y, tmp ); + return stdlib_complex128( x, tmp ); } diff --git a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.native.js index a7dd2d94338..d2b1375e959 100644 --- a/lib/node_modules/@stdlib/math/base/special/ccis/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/ccis/test/test.native.js @@ -55,7 +55,7 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); -tape( 'the function works without output array specified', opts, function test( t ) { +tape( 'the function evaluates the cis function for a double-precision complex floating-point number', opts, function test( t ) { var v; var z;