@@ -25,7 +25,7 @@ var tape = require( 'tape' );
2525var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
2626var randu = require ( '@stdlib/random/base/randu' ) ;
2727var tryRequire = require ( '@stdlib/utils/try-require' ) ;
28- var abs = require ( '@stdlib/math/base/special/abs ' ) ;
28+ var isAlmostSameValue = require ( '@stdlib/assert/is-almost-same-value ' ) ;
2929var EPS = require ( '@stdlib/constants/float64/eps' ) ;
3030var isPositiveZero = require ( '@stdlib/assert/is-positive-zero' ) ;
3131
@@ -55,8 +55,6 @@ tape( 'main export is a function', opts, function test( t ) {
5555
5656tape ( 'the function computes the arccosine' , opts , function test ( t ) {
5757 var expected ;
58- var delta ;
59- var tol ;
6058 var x ;
6159 var y ;
6260 var i ;
@@ -66,21 +64,13 @@ tape( 'the function computes the arccosine', opts, function test( t ) {
6664
6765 for ( i = 0 ; i < x . length ; i ++ ) {
6866 y = acos ( x [ i ] ) ;
69- if ( y === expected [ i ] ) {
70- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + '. E: ' + expected [ i ] ) ;
71- } else {
72- delta = abs ( y - expected [ i ] ) ;
73- tol = EPS * abs ( expected [ i ] ) ;
74- t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ) ;
75- }
67+ t . strictEqual ( isAlmostSameValue ( y , expected [ i ] , 1 ) , true , 'returns expected value' ) ;
7668 }
7769 t . end ( ) ;
7870} ) ;
7971
8072tape ( 'the function computes the arccosine (small negative numbers)' , opts , function test ( t ) {
8173 var expected ;
82- var delta ;
83- var tol ;
8474 var x ;
8575 var y ;
8676 var i ;
@@ -90,21 +80,13 @@ tape( 'the function computes the arccosine (small negative numbers)', opts, func
9080
9181 for ( i = 0 ; i < x . length ; i ++ ) {
9282 y = acos ( x [ i ] ) ;
93- if ( y === expected [ i ] ) {
94- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + '. E: ' + expected [ i ] ) ;
95- } else {
96- delta = abs ( y - expected [ i ] ) ;
97- tol = EPS * abs ( expected [ i ] ) ;
98- t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ) ;
99- }
83+ t . strictEqual ( isAlmostSameValue ( y , expected [ i ] , 1 ) , true , 'returns expected value' ) ;
10084 }
10185 t . end ( ) ;
10286} ) ;
10387
10488tape ( 'the function computes the arccosine (small positive numbers)' , opts , function test ( t ) {
10589 var expected ;
106- var delta ;
107- var tol ;
10890 var x ;
10991 var y ;
11092 var i ;
@@ -114,13 +96,7 @@ tape( 'the function computes the arccosine (small positive numbers)', opts, func
11496
11597 for ( i = 0 ; i < x . length ; i ++ ) {
11698 y = acos ( x [ i ] ) ;
117- if ( y === expected [ i ] ) {
118- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + '. E: ' + expected [ i ] ) ;
119- } else {
120- delta = abs ( y - expected [ i ] ) ;
121- tol = EPS * abs ( expected [ i ] ) ;
122- t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ) ;
123- }
99+ t . strictEqual ( isAlmostSameValue ( y , expected [ i ] , 1 ) , true , 'returns expected value' ) ;
124100 }
125101 t . end ( ) ;
126102} ) ;
0 commit comments