Skip to content

Commit 55ce598

Browse files
committed
test: add tests for signed zeros
1 parent 7155e52 commit 55ce598

File tree

2 files changed

+46
-6
lines changed

2 files changed

+46
-6
lines changed

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ var EPS = require( '@stdlib/constants/float64/eps' );
2727
var PINF = require( '@stdlib/constants/float64/pinf' );
2828
var NINF = require( '@stdlib/constants/float64/ninf' );
2929
var PI = require( '@stdlib/constants/float64/pi' );
30+
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
31+
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
3032
var atan = require( './../lib' );
3133

3234

@@ -369,18 +371,36 @@ tape( 'the function computes the arctangent on the interval `[1e300,1e308]`', fu
369371

370372
tape( 'the function returns `NaN` if provided `NaN`', function test( t ) {
371373
var v = atan( NaN );
372-
t.equal( isnan( v ), true, 'returns NaN' );
374+
t.equal( isnan( v ), true, 'returns expected value' );
373375
t.end();
374376
});
375377

376378
tape( 'the function returns `pi/2` if provided `+infinity`', function test( t ) {
377379
var v = atan( PINF );
378-
t.equal( v, PI/2, 'returns pi/2' );
380+
t.equal( v, PI/2, 'returns expected value' );
379381
t.end();
380382
});
381383

382384
tape( 'the function returns `-pi/2` if provided `-infinity`', function test( t ) {
383385
var v = atan( NINF );
384-
t.equal( v, -PI/2, 'returns -pi/2' );
386+
t.equal( v, -PI/2, 'returns expected value' );
387+
t.end();
388+
});
389+
390+
tape( 'the function returns `-0` if provided `-0`', function test( t ) {
391+
var v = atan( -0.0 );
392+
t.equal( isNegativeZero( v ), true, 'returns expected value' );
393+
t.end();
394+
});
395+
396+
tape( 'the function returns `0` if provided +0', function test( t ) {
397+
var v;
398+
399+
v = atan( 0.0 );
400+
t.equal( isPositiveZero( v ), true, 'returns expected value' );
401+
402+
v = atan( +0.0 );
403+
t.equal( isPositiveZero( v ), true, 'returns expected value' );
404+
385405
t.end();
386406
});

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ var EPS = require( '@stdlib/constants/float64/eps' );
2929
var PINF = require( '@stdlib/constants/float64/pinf' );
3030
var NINF = require( '@stdlib/constants/float64/ninf' );
3131
var PI = require( '@stdlib/constants/float64/pi' );
32+
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
33+
var isPositiveZero = require( '@stdlib/math/base/assert/is-positive-zero' );
3234

3335

3436
// FIXTURES //
@@ -378,18 +380,36 @@ tape( 'the function computes the arctangent on the interval `[1e300,1e308]`', op
378380

379381
tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) {
380382
var v = atan( NaN );
381-
t.equal( isnan( v ), true, 'returns NaN' );
383+
t.equal( isnan( v ), true, 'returns expected value' );
382384
t.end();
383385
});
384386

385387
tape( 'the function returns `pi/2` if provided `+infinity`', opts, function test( t ) {
386388
var v = atan( PINF );
387-
t.equal( v, PI/2, 'returns pi/2' );
389+
t.equal( v, PI/2, 'returns expected value' );
388390
t.end();
389391
});
390392

391393
tape( 'the function returns `-pi/2` if provided `-infinity`', opts, function test( t ) {
392394
var v = atan( NINF );
393-
t.equal( v, -PI/2, 'returns -pi/2' );
395+
t.equal( v, -PI/2, 'returns expected value' );
396+
t.end();
397+
});
398+
399+
tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) {
400+
var v = atan( -0.0 );
401+
t.equal( isNegativeZero( v ), true, 'returns expected value' );
402+
t.end();
403+
});
404+
405+
tape( 'the function returns `0` if provided +0', opts, function test( t ) {
406+
var v;
407+
408+
v = atan( 0.0 );
409+
t.equal( isPositiveZero( v ), true, 'returns expected value' );
410+
411+
v = atan( +0.0 );
412+
t.equal( isPositiveZero( v ), true, 'returns expected value' );
413+
394414
t.end();
395415
});

0 commit comments

Comments
 (0)