@@ -27,7 +27,8 @@ var tape = require( 'tape' );
2727var isnanf = require ( '@stdlib/math/base/assert/is-nanf' ) ;
2828var absf = require ( '@stdlib/math/base/special/absf' ) ;
2929var EPS = require ( '@stdlib/constants/float32/eps' ) ;
30- var FLOAT32_SMALLEST_NORMAL = require ( '@stdlib/constants/float32/smallest-normal' ) ;
30+ var PINF = require ( '@stdlib/constants/float32/pinf' ) ;
31+ var NINF = require ( '@stdlib/constants/float32/ninf' ) ;
3132var Complex64 = require ( '@stdlib/complex/float32/ctor' ) ;
3233var real = require ( '@stdlib/complex/float32/real' ) ;
3334var imag = require ( '@stdlib/complex/float32/imag' ) ;
@@ -40,8 +41,6 @@ var cinvf = tryRequire( resolve( __dirname, './../lib/native.js' ) );
4041var opts = {
4142 'skip' : ( cinvf instanceof Error )
4243} ;
43- var HUGE = 1.0e37 ;
44- var TINY = - 1.0e37 ;
4544
4645
4746// FIXTURES //
@@ -398,40 +397,40 @@ tape( 'the function computes a complex inverse (tiny positive real components)',
398397 t . end ( ) ;
399398} ) ;
400399
401- tape ( 'the function may produce very large values for very small inputs ' , opts , function test ( t ) {
400+ tape ( 'the function may overflow ' , opts , function test ( t ) {
402401 var v ;
403402
404- v = cinvf ( new Complex64 ( FLOAT32_SMALLEST_NORMAL , FLOAT32_SMALLEST_NORMAL ) ) ; // eslint-disable-line max-len
405- t . ok ( real ( v ) > HUGE , 'returns expected value. ' ) ;
406- t . ok ( imag ( v ) < TINY , 'returns expected value. ' ) ;
403+ v = cinvf ( new Complex64 ( 1.4e-45 , 1.4e-45 ) ) ;
404+ t . strictEqual ( real ( v ) , PINF , 'returns expected value' ) ;
405+ t . strictEqual ( imag ( v ) , NINF , 'returns expected value' ) ;
407406
408- v = cinvf ( new Complex64 ( - FLOAT32_SMALLEST_NORMAL , FLOAT32_SMALLEST_NORMAL ) ) ; // eslint-disable-line max-len
409- t . ok ( real ( v ) < TINY , 'returns expected value. ' ) ;
410- t . ok ( imag ( v ) < TINY , 'returns expected value. ' ) ;
407+ v = cinvf ( new Complex64 ( - 1.4e-45 , 1.4e-45 ) ) ;
408+ t . strictEqual ( real ( v ) , NINF , 'returns expected value' ) ;
409+ t . strictEqual ( imag ( v ) , NINF , 'returns expected value' ) ;
411410
412- v = cinvf ( new Complex64 ( - FLOAT32_SMALLEST_NORMAL , - FLOAT32_SMALLEST_NORMAL ) ) ; // eslint-disable-line max-len
413- t . ok ( real ( v ) < TINY , 'returns expected value. ' ) ;
414- t . ok ( imag ( v ) > HUGE , 'returns expected value. ' ) ;
411+ v = cinvf ( new Complex64 ( - 1.4e-45 , - 1.4e-45 ) ) ;
412+ t . strictEqual ( real ( v ) , NINF , 'returns expected value' ) ;
413+ t . strictEqual ( imag ( v ) , PINF , 'returns expected value' ) ;
415414
416- v = cinvf ( new Complex64 ( FLOAT32_SMALLEST_NORMAL , - FLOAT32_SMALLEST_NORMAL ) ) ; // eslint-disable-line max-len
417- t . ok ( real ( v ) > HUGE , 'returns expected value. ' ) ;
418- t . ok ( imag ( v ) > HUGE , 'returns expected value. ' ) ;
415+ v = cinvf ( new Complex64 ( 1.4e-45 , - 1.4e-45 ) ) ;
416+ t . strictEqual ( real ( v ) , PINF , 'returns expected value' ) ;
417+ t . strictEqual ( imag ( v ) , PINF , 'returns expected value' ) ;
419418
420- v = cinvf ( new Complex64 ( 0.0 , FLOAT32_SMALLEST_NORMAL ) ) ;
421- t . strictEqual ( real ( v ) , 0.0 , 'returns expected value. ' ) ;
422- t . ok ( imag ( v ) < TINY , 'returns expected value. ' ) ;
419+ v = cinvf ( new Complex64 ( 0.0 , 1.4e-45 ) ) ;
420+ t . strictEqual ( real ( v ) , 0.0 , 'returns expected value' ) ;
421+ t . strictEqual ( imag ( v ) , NINF , 'returns expected value' ) ;
423422
424- v = cinvf ( new Complex64 ( 0.0 , - FLOAT32_SMALLEST_NORMAL ) ) ;
425- t . strictEqual ( real ( v ) , 0.0 , 'returns expected value. ' ) ;
426- t . ok ( imag ( v ) > HUGE , 'returns expected value. ' ) ;
423+ v = cinvf ( new Complex64 ( 0.0 , - 1.4e-45 ) ) ;
424+ t . strictEqual ( real ( v ) , 0.0 , 'returns expected value' ) ;
425+ t . strictEqual ( imag ( v ) , PINF , 'returns expected value' ) ;
427426
428- v = cinvf ( new Complex64 ( FLOAT32_SMALLEST_NORMAL , 0.0 ) ) ;
429- t . ok ( real ( v ) > HUGE , 'returns expected value. ' ) ;
430- t . strictEqual ( imag ( v ) , 0.0 , 'returns expected value. ' ) ;
427+ v = cinvf ( new Complex64 ( 1.4e-45 , 0.0 ) ) ;
428+ t . strictEqual ( real ( v ) , PINF , 'returns expected value' ) ;
429+ t . strictEqual ( imag ( v ) , 0.0 , 'returns expected value' ) ;
431430
432- v = cinvf ( new Complex64 ( - FLOAT32_SMALLEST_NORMAL , 0.0 ) ) ;
433- t . ok ( real ( v ) < TINY , 'returns expected value. ' ) ;
434- t . strictEqual ( imag ( v ) , 0.0 , 'returns expected value. ' ) ;
431+ v = cinvf ( new Complex64 ( - 1.4e-45 , 0.0 ) ) ;
432+ t . strictEqual ( real ( v ) , NINF , 'returns expected value' ) ;
433+ t . strictEqual ( imag ( v ) , 0.0 , 'returns expected value' ) ;
435434
436435 t . end ( ) ;
437436} ) ;
0 commit comments