@@ -26,7 +26,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626var randu = require ( '@stdlib/random/base/randu' ) ;
2727var PINF = require ( '@stdlib/constants/float64/pinf' ) ;
2828var EPS = require ( '@stdlib/constants/float64/eps' ) ;
29- var abs = require ( '@stdlib/math/base/special/abs ' ) ;
29+ var isAlmostSameValue = require ( '@stdlib/assert/is-almost-same-value ' ) ;
3030var isPositiveZero = require ( '@stdlib/assert/is-positive-zero' ) ;
3131var tryRequire = require ( '@stdlib/utils/try-require' ) ;
3232
@@ -57,8 +57,6 @@ tape( 'main export is a function', opts, function test( t ) {
5757
5858tape ( 'the function computes the hyperbolic arccosine on the interval [1.0,3.0]' , opts , function test ( t ) {
5959 var expected ;
60- var delta ;
61- var tol ;
6260 var x ;
6361 var y ;
6462 var i ;
@@ -68,21 +66,13 @@ tape( 'the function computes the hyperbolic arccosine on the interval [1.0,3.0]'
6866
6967 for ( i = 0 ; i < x . length ; i ++ ) {
7068 y = acosh ( x [ i ] ) ;
71- if ( y === expected [ i ] ) {
72- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + '. E: ' + expected [ i ] ) ;
73- } else {
74- delta = abs ( y - expected [ i ] ) ;
75- tol = 1.0 * EPS * abs ( expected [ i ] ) ;
76- t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ) ;
77- }
69+ t . strictEqual ( isAlmostSameValue ( y , expected [ i ] , 1 ) , true , 'returns expected value' ) ;
7870 }
7971 t . end ( ) ;
8072} ) ;
8173
8274tape ( 'the function computes the hyperbolic arccosine on the interval [3.0,28.0]' , opts , function test ( t ) {
8375 var expected ;
84- var delta ;
85- var tol ;
8676 var x ;
8777 var y ;
8878 var i ;
@@ -92,21 +82,13 @@ tape( 'the function computes the hyperbolic arccosine on the interval [3.0,28.0]
9282
9383 for ( i = 0 ; i < x . length ; i ++ ) {
9484 y = acosh ( x [ i ] ) ;
95- if ( y === expected [ i ] ) {
96- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + '. E: ' + expected [ i ] ) ;
97- } else {
98- delta = abs ( y - expected [ i ] ) ;
99- tol = 1.0 * EPS * abs ( expected [ i ] ) ;
100- t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ) ;
101- }
85+ t . strictEqual ( isAlmostSameValue ( y , expected [ i ] , 1 ) , true , 'returns expected value' ) ;
10286 }
10387 t . end ( ) ;
10488} ) ;
10589
10690tape ( 'the function computes the hyperbolic arccosine on the interval [28.0,100.0]' , opts , function test ( t ) {
10791 var expected ;
108- var delta ;
109- var tol ;
11092 var x ;
11193 var y ;
11294 var i ;
@@ -116,21 +98,13 @@ tape( 'the function computes the hyperbolic arccosine on the interval [28.0,100.
11698
11799 for ( i = 0 ; i < x . length ; i ++ ) {
118100 y = acosh ( x [ i ] ) ;
119- if ( y === expected [ i ] ) {
120- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + '. E: ' + expected [ i ] ) ;
121- } else {
122- delta = abs ( y - expected [ i ] ) ;
123- tol = 1.0 * EPS * abs ( expected [ i ] ) ;
124- t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ) ;
125- }
101+ t . strictEqual ( isAlmostSameValue ( y , expected [ i ] , 1 ) , true , 'returns expected value' ) ;
126102 }
127103 t . end ( ) ;
128104} ) ;
129105
130106tape ( 'the function computes the hyperbolic arccosine for huge values' , opts , function test ( t ) {
131107 var expected ;
132- var delta ;
133- var tol ;
134108 var x ;
135109 var y ;
136110 var i ;
@@ -140,13 +114,7 @@ tape( 'the function computes the hyperbolic arccosine for huge values', opts, fu
140114
141115 for ( i = 0 ; i < x . length ; i ++ ) {
142116 y = acosh ( x [ i ] ) ;
143- if ( y === expected [ i ] ) {
144- t . strictEqual ( y , expected [ i ] , 'x: ' + x [ i ] + '. E: ' + expected [ i ] ) ;
145- } else {
146- delta = abs ( y - expected [ i ] ) ;
147- tol = 1.0 * EPS * abs ( expected [ i ] ) ;
148- t . ok ( delta <= tol , 'within tolerance. x: ' + x [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. tol: ' + tol + '. Δ: ' + delta + '.' ) ;
149- }
117+ t . strictEqual ( isAlmostSameValue ( y , expected [ i ] , 1 ) , true , 'returns expected value' ) ;
150118 }
151119 t . end ( ) ;
152120} ) ;
0 commit comments