File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/constants/float16/sqrt-half/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121// MODULES //
2222
2323var tape = require ( 'tape' ) ;
24- var abs = require ( '@stdlib/math/ base/special/abs ' ) ;
24+ var f16 = require ( '@stdlib/number/float64/ base/to-float16 ' ) ;
2525var sqrt = require ( '@stdlib/math/base/special/sqrt' ) ;
2626var FLOAT16_SQRT_HALF = require ( './../lib' ) ;
2727
@@ -39,10 +39,7 @@ tape( 'the exported value is a half-precision floating-point number equal to 0.7
3939 t . end ( ) ;
4040} ) ;
4141
42- tape ( 'the exported value is close to sqrt(0.5) within float16 precision' , function test ( t ) {
43- var expected = sqrt ( 0.5 ) ;
44- var delta = abs ( FLOAT16_SQRT_HALF - expected ) ;
45- var tol = 1.0e-3 ; // float16 tolerance
46- t . ok ( delta <= tol , 'within tolerance. expected: ' + expected + '. actual: ' + FLOAT16_SQRT_HALF + '. delta: ' + delta + '. tol: ' + tol + '.' ) ;
42+ tape ( 'the exported value is equal to sqrt(0.5) within half-precision' , function test ( t ) {
43+ t . strictEqual ( FLOAT16_SQRT_HALF , f16 ( sqrt ( 0.5 ) ) , 'returns expected value' ) ;
4744 t . end ( ) ;
4845} ) ;
You can’t perform that action at this time.
0 commit comments