@@ -25,11 +25,10 @@ var tape = require( 'tape' );
25
25
var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
26
26
var PINF = require ( '@stdlib/constants/float64/pinf' ) ;
27
27
var NINF = require ( '@stdlib/constants/float64/ninf' ) ;
28
- var EPS = require ( '@stdlib/constants/float64/eps' ) ;
29
- var abs = require ( '@stdlib/math/base/special/abs' ) ;
30
28
var isNegativeZero = require ( '@stdlib/assert/is-negative-zero' ) ;
31
29
var isPositiveZero = require ( '@stdlib/assert/is-positive-zero' ) ;
32
30
var isSameValue = require ( '@stdlib/assert/is-same-value' ) ;
31
+ var ulpdiff = require ( '@stdlib/number/float64/base/ulp-difference' ) ;
33
32
var tryRequire = require ( '@stdlib/utils/try-require' ) ;
34
33
35
34
@@ -91,7 +90,7 @@ tape( 'if provided an integer, the function returns `+-0`', opts, function test(
91
90
expected = integers . expected ;
92
91
for ( i = 0 ; i < x . length ; i ++ ) {
93
92
y = sinpi ( x [ i ] ) ;
94
- t . strictEqual ( isSameValue ( y , expected [ i ] ) , true , 'returns ' + expected [ i ] ) ;
93
+ t . strictEqual ( isSameValue ( y , expected [ i ] ) , true , 'returns expected value' ) ;
95
94
}
96
95
t . end ( ) ;
97
96
} ) ;
@@ -106,14 +105,13 @@ tape( 'the function is odd', opts, function test( t ) {
106
105
for ( i = 0 ; i < x . length ; i ++ ) {
107
106
y = sinpi ( - x [ i ] ) ;
108
107
expected = - sinpi ( x [ i ] ) ;
109
- t . strictEqual ( y , expected , 'returns ' + expected ) ;
108
+ t . strictEqual ( y , expected , 'returns expected value' ) ;
110
109
}
111
110
t . end ( ) ;
112
111
} ) ;
113
112
114
113
tape ( 'the function computes `sin(πx)`' , opts , function test ( t ) {
115
114
var expected ;
116
- var delta ;
117
115
var x ;
118
116
var y ;
119
117
var i ;
@@ -122,12 +120,7 @@ tape( 'the function computes `sin(πx)`', opts, function test( t ) {
122
120
expected = decimals . expected ;
123
121
for ( i = 0 ; i < x . length ; i ++ ) {
124
122
y = sinpi ( x [ i ] ) ;
125
- if ( y === expected [ i ] ) {
126
- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + '. Expected: ' + expected [ i ] ) ;
127
- } else {
128
- delta = abs ( y - expected [ i ] ) ;
129
- t . ok ( delta <= EPS , 'within tolerance. x: ' + x [ i ] + '. Value: ' + y + '. Expected: ' + expected [ i ] + '. Tolerance: ' + EPS + '.' ) ;
130
- }
123
+ t . strictEqual ( ulpdiff ( y , expected [ i ] ) <= 1 , true , 'returns expected value within 1 ulp' ) ;
131
124
}
132
125
t . end ( ) ;
133
126
} ) ;
0 commit comments