Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion lib/node_modules/@stdlib/math/base/special/cospi/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var pow = require( '@stdlib/math/base/special/pow' );
var isPositiveZero = require( '@stdlib/assert/is-positive-zero' );
var cospi = require( './../lib/' );


Expand Down Expand Up @@ -99,7 +100,22 @@ tape( 'the function returns `0` for any value with fractional part equal to 1/2'
x = incrspace( 0.5, 100.5, 1.0 );
for ( i = 0; i < x.length; i++ ) {
y = cospi( x[i] );
t.equal( y, 0.0, 'x: '+x[i]+'. E: 0' );
t.equal( isPositiveZero( y ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function is even', function test( t ) {
var expected;
var x;
var y;
var i;

x = decimals.x;
for ( i = 0; i < x.length; i++ ) {
y = cospi( -x[i] );
expected = cospi( x[i] );
t.equal( y, expected, 'returns '+expected );
}
t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var pow = require( '@stdlib/math/base/special/pow' );
var isPositiveZero = require( '@stdlib/assert/is-positive-zero' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand Down Expand Up @@ -108,7 +109,22 @@ tape( 'the function returns `0` for any value with fractional part equal to 1/2'
x = incrspace( 0.5, 100.5, 1.0 );
for ( i = 0; i < x.length; i++ ) {
y = cospi( x[i] );
t.equal( y, 0.0, 'x: '+x[i]+'. E: 0' );
t.equal( isPositiveZero( y ), true, 'returns expected value' );
}
t.end();
});

tape( 'the function is even', opts, function test( t ) {
var expected;
var x;
var y;
var i;

x = decimals.x;
for ( i = 0; i < x.length; i++ ) {
y = cospi( -x[i] );
expected = cospi( x[i] );
t.equal( y, expected, 'returns '+expected );
}
t.end();
});
Expand Down