Skip to content

Commit

Permalink
fix: add review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
steff456 committed Jul 21, 2023
1 parent b692d3b commit 9648df0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
28 changes: 16 additions & 12 deletions lib/node_modules/@stdlib/math/base/special/ccis/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 //

/**
Expand All @@ -41,33 +47,33 @@ var imag = require( '@stdlib/complex/imag' );
* var imag = require( '@stdlib/complex/imag' );
*
* var z = new Complex128( 0.0, 0.0 );
* // returns <Complex128>
* // throws { 're': 0, 'im': 0 }
*
* var out = ccis( z );
* // returns <Complex128>
* // throws <TypeError>
*
* var re = real( out );
* // returns 1.0
* // throws <TypeError>
*
* var im = imag( out );
* // returns 0.0
* // throws <TypeError>
*
* @example
* var Complex128 = require( '@stdlib/complex/float64' );
* var real = require( '@stdlib/complex/real' );
* var imag = require( '@stdlib/complex/imag' );
*
* var z = new Complex128( 1.0, 0.0 );
* // returns <Complex128>
* // throws { 're': 1, 'im': 0 }
*
* var out = ccis( z );
* // returns <Complex128>
* // throws <TypeError>
*
* var re = real( out );
* // returns ~0.540
* // throws <TypeError>
*
* var im = imag( out );
* // returns ~0.841
* // throws <TypeError>
*/
function ccis( z ) {
var out;
Expand All @@ -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 );
}


Expand Down
3 changes: 1 addition & 2 deletions lib/node_modules/@stdlib/math/base/special/ccis/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 9648df0

Please sign in to comment.