Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/math/base/special/atanf/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ function atanf( x ) {
var y;
var z;

if ( isnanf( x ) ) {
return NaN;
if ( isnanf( x ) || x === 0.0 ) {
return x;
}
x = float64ToFloat32( x );
if ( x < 0.0 ) {
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/math/base/special/atanf/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ float stdlib_base_atanf( const float x ) {
float y;
float z;

if ( stdlib_base_is_nanf( x ) ) {
return 0.0f / 0.0f; // NaN
if ( stdlib_base_is_nanf( x ) || x == 0.0f ) {
return x;
}
ax = x;
if ( x < 0.0f ) {
Expand Down
20 changes: 20 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/atanf/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var abs = require( '@stdlib/math/base/special/abs' );
var EPS = require( '@stdlib/constants/float32/eps' );
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
var atanf = require( './../lib' );


Expand Down Expand Up @@ -396,3 +398,21 @@ tape( 'the function returns `NaN` if provided `NaN`', function test( t ) {
t.equal( isnanf( v ), true, 'returns NaN' );
t.end();
});

tape( 'the function returns `-0` if provided `-0`', function test( t ) {
var v = atanf( -0.0 );
t.equal( isNegativeZerof( v ), true, 'returns -0' );
t.end();
});

tape( 'the function returns `0` if provided +0', function test( t ) {
var v;

v = atanf( 0.0 );
t.equal( isPositiveZerof( v ), true, 'returns +0' );

v = atanf( +0.0 );
t.equal( isPositiveZerof( v ), true, 'returns +0' );

t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
var abs = require( '@stdlib/math/base/special/abs' );
var EPS = require( '@stdlib/constants/float32/eps' );
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' );
var isPositiveZerof = require( '@stdlib/math/base/assert/is-positive-zerof' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand Down Expand Up @@ -405,3 +407,21 @@ tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) {
t.equal( isnanf( v ), true, 'returns NaN' );
t.end();
});

tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) {
var v = atanf( -0.0 );
t.equal( isNegativeZerof( v ), true, 'returns -0' );
t.end();
});

tape( 'the function returns `0` if provided +0', opts, function test( t ) {
var v;

v = atanf( 0.0 );
t.equal( isPositiveZerof( v ), true, 'returns +0' );

v = atanf( +0.0 );
t.equal( isPositiveZerof( v ), true, 'returns +0' );

t.end();
});