Skip to content

Commit 1e4b912

Browse files
committed
test: add tests for infinities
1 parent 55ce598 commit 1e4b912

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

lib/node_modules/@stdlib/math/base/special/atanf/test/test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ var tape = require( 'tape' );
2424
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2525
var abs = require( '@stdlib/math/base/special/abs' );
2626
var EPS = require( '@stdlib/constants/float32/eps' );
27+
var PINF = require( '@stdlib/constants/float32/pinf' );
28+
var NINF = require( '@stdlib/constants/float32/ninf' );
29+
var HALF_PI = require( '@stdlib/constants/float32/half-pi' );
2730
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
2831
var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
2932
var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
@@ -399,6 +402,18 @@ tape( 'the function returns `NaN` if provided `NaN`', function test( t ) {
399402
t.end();
400403
});
401404

405+
tape( 'the function returns `pi/2` if provided `+infinity`', function test( t ) {
406+
var v = atanf( PINF );
407+
t.equal( v, HALF_PI, 'returns expected value' );
408+
t.end();
409+
});
410+
411+
tape( 'the function returns `-pi/2` if provided `-infinity`', function test( t ) {
412+
var v = atanf( NINF );
413+
t.equal( v, -HALF_PI, 'returns expected value' );
414+
t.end();
415+
});
416+
402417
tape( 'the function returns `-0` if provided `-0`', function test( t ) {
403418
var v = atanf( -0.0 );
404419
t.equal( isNegativeZerof( v ), true, 'returns -0' );

lib/node_modules/@stdlib/math/base/special/atanf/test/test.native.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ var tape = require( 'tape' );
2525
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2626
var abs = require( '@stdlib/math/base/special/abs' );
2727
var EPS = require( '@stdlib/constants/float32/eps' );
28+
var PINF = require( '@stdlib/constants/float32/pinf' );
29+
var NINF = require( '@stdlib/constants/float32/ninf' );
30+
var HALF_PI = require( '@stdlib/constants/float32/half-pi' );
2831
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
2932
var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
3033
var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
@@ -408,6 +411,18 @@ tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) {
408411
t.end();
409412
});
410413

414+
tape( 'the function returns `pi/2` if provided `+infinity`', opts, function test( t ) {
415+
var v = atanf( PINF );
416+
t.equal( v, HALF_PI, 'returns expected value' );
417+
t.end();
418+
});
419+
420+
tape( 'the function returns `-pi/2` if provided `-infinity`', opts, function test( t ) {
421+
var v = atanf( NINF );
422+
t.equal( v, -HALF_PI, 'returns expected value' );
423+
t.end();
424+
});
425+
411426
tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) {
412427
var v = atanf( -0.0 );
413428
t.equal( isNegativeZerof( v ), true, 'returns -0' );

0 commit comments

Comments
 (0)