File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
lib/node_modules/@stdlib/math/base/special/cospi/test Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ var NINF = require( '@stdlib/constants/float64/ninf' );
2828var EPS = require ( '@stdlib/constants/float64/eps' ) ;
2929var abs = require ( '@stdlib/math/base/special/abs' ) ;
3030var pow = require ( '@stdlib/math/base/special/pow' ) ;
31+ var isPositiveZero = require ( '@stdlib/assert/is-positive-zero' ) ;
3132var cospi = require ( './../lib/' ) ;
3233
3334
@@ -99,7 +100,22 @@ tape( 'the function returns `0` for any value with fractional part equal to 1/2'
99100 x = incrspace ( 0.5 , 100.5 , 1.0 ) ;
100101 for ( i = 0 ; i < x . length ; i ++ ) {
101102 y = cospi ( x [ i ] ) ;
102- t . equal ( y , 0.0 , 'x: ' + x [ i ] + '. E: 0' ) ;
103+ t . equal ( isPositiveZero ( y ) , true , 'returns expected value' ) ;
104+ }
105+ t . end ( ) ;
106+ } ) ;
107+
108+ tape ( 'the function is even' , function test ( t ) {
109+ var expected ;
110+ var x ;
111+ var y ;
112+ var i ;
113+
114+ x = decimals . x ;
115+ for ( i = 0 ; i < x . length ; i ++ ) {
116+ y = cospi ( - x [ i ] ) ;
117+ expected = cospi ( x [ i ] ) ;
118+ t . equal ( y , expected , 'returns ' + expected ) ;
103119 }
104120 t . end ( ) ;
105121} ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ var NINF = require( '@stdlib/constants/float64/ninf' );
2929var EPS = require ( '@stdlib/constants/float64/eps' ) ;
3030var abs = require ( '@stdlib/math/base/special/abs' ) ;
3131var pow = require ( '@stdlib/math/base/special/pow' ) ;
32+ var isPositiveZero = require ( '@stdlib/assert/is-positive-zero' ) ;
3233var tryRequire = require ( '@stdlib/utils/try-require' ) ;
3334
3435
@@ -108,7 +109,22 @@ tape( 'the function returns `0` for any value with fractional part equal to 1/2'
108109 x = incrspace ( 0.5 , 100.5 , 1.0 ) ;
109110 for ( i = 0 ; i < x . length ; i ++ ) {
110111 y = cospi ( x [ i ] ) ;
111- t . equal ( y , 0.0 , 'x: ' + x [ i ] + '. E: 0' ) ;
112+ t . equal ( isPositiveZero ( y ) , true , 'returns expected value' ) ;
113+ }
114+ t . end ( ) ;
115+ } ) ;
116+
117+ tape ( 'the function is even' , opts , function test ( t ) {
118+ var expected ;
119+ var x ;
120+ var y ;
121+ var i ;
122+
123+ x = decimals . x ;
124+ for ( i = 0 ; i < x . length ; i ++ ) {
125+ y = cospi ( - x [ i ] ) ;
126+ expected = cospi ( x [ i ] ) ;
127+ t . equal ( y , expected , 'returns ' + expected ) ;
112128 }
113129 t . end ( ) ;
114130} ) ;
You can’t perform that action at this time.
0 commit comments