@@ -24,10 +24,9 @@ var tape = require( 'tape' );
2424var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
2525var PINF = require ( '@stdlib/constants/float64/pinf' ) ;
2626var NINF = require ( '@stdlib/constants/float64/ninf' ) ;
27- var EPS = require ( '@stdlib/constants/float64/eps ' ) ;
27+ var isAlmostSameValue = require ( '@stdlib/assert/is-almost-same-value ' ) ;
2828var fibonacci = require ( '@stdlib/math/base/special/fibonacci' ) ;
2929var negaFibonacci = require ( '@stdlib/math/base/special/negafibonacci' ) ;
30- var abs = require ( '@stdlib/math/base/special/abs' ) ;
3130var binet = require ( './../lib' ) ;
3231
3332
@@ -59,8 +58,6 @@ tape( 'if provided `-infinity`, the function returns `NaN`', function test( t )
5958
6059tape ( 'for nonnegative integers, the function approximates the nth Fibonacci number' , function test ( t ) {
6160 var expected ;
62- var delta ;
63- var tol ;
6461 var v ;
6562 var i ;
6663 for ( i = 0 ; i < 79 ; i ++ ) {
@@ -69,18 +66,18 @@ tape( 'for nonnegative integers, the function approximates the nth Fibonacci num
6966 if ( v === expected ) {
7067 t . strictEqual ( v , expected , 'returns the ' + i + 'th Fibonacci number' ) ;
7168 } else {
72- delta = abs ( v - expected ) ;
73- tol = 13.0 * EPS * abs ( expected ) ;
74- t . strictEqual ( delta <= tol , true , 'returns approximation. n: ' + i + '. expected: ' + expected + '. actual: ' + v + '. Δ: ' + delta + '. tol: ' + tol + '.' ) ;
69+ t . strictEqual (
70+ isAlmostSameValue ( v , expected , 24 ) ,
71+ true ,
72+ 'returns expected value'
73+ ) ;
7574 }
7675 }
7776 t . end ( ) ;
7877} ) ;
7978
8079tape ( 'for nonpositive integers, the function approximates the nth negaFibonacci number' , function test ( t ) {
8180 var expected ;
82- var delta ;
83- var tol ;
8481 var v ;
8582 var i ;
8683 for ( i = 0 ; i > - 79 ; i -- ) {
@@ -89,9 +86,11 @@ tape( 'for nonpositive integers, the function approximates the nth negaFibonacci
8986 if ( v === expected ) {
9087 t . strictEqual ( v , expected , 'returns the ' + i + 'th negaFibonacci number' ) ;
9188 } else {
92- delta = abs ( v - expected ) ;
93- tol = 12.0 * EPS * abs ( expected ) ;
94- t . strictEqual ( delta <= tol , true , 'returns approximation. n: ' + i + '. expected: ' + expected + '. actual: ' + v + '. Δ: ' + delta + '. tol: ' + tol + '.' ) ;
89+ t . strictEqual (
90+ isAlmostSameValue ( v , expected , 24 ) ,
91+ true ,
92+ 'returns expected value'
93+ ) ;
9594 }
9695 }
9796 t . end ( ) ;
0 commit comments