Skip to content

test: add tests for IEEE 754-2019 compliance #6557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 5, 2025
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
14 changes: 14 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/asin/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
var randu = require( '@stdlib/random/base/randu' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isNegativeZero = require( '@stdlib/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/assert/is-positive-zero' );
var asin = require( './../lib' );


Expand Down Expand Up @@ -142,3 +144,15 @@ tape( 'the function returns `NaN` if provided a value greater than `+1`', functi
}
t.end();
});

tape( 'the function returns `-0` if provided `-0`', function test( t ) {
var v = asin( -0.0 );
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `+0` if provided `+0`', function test( t ) {
var v = asin( 0.0 );
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ var randu = require( '@stdlib/random/base/randu' );
var tryRequire = require( '@stdlib/utils/try-require' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isNegativeZero = require( '@stdlib/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/assert/is-positive-zero' );


// FIXTURES //
Expand Down Expand Up @@ -151,3 +153,15 @@ tape( 'the function returns `NaN` if provided a value greater than `+1`', opts,
}
t.end();
});

tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) {
var v = asin( -0.0 );
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `+0` if provided `+0`', opts, function test( t ) {
var v = asin( 0.0 );
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
t.end();
});
14 changes: 14 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/sinpi/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isNegativeZero = require( '@stdlib/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/assert/is-positive-zero' );
var isSameValue = require( '@stdlib/assert/is-same-value' );
var sinpi = require( './../lib/' );

Expand Down Expand Up @@ -58,6 +60,18 @@ tape( 'if provided `NaN`, the function returns `NaN`', function test( t ) {
t.end();
});

tape( 'the function returns `-0` if provided `-0`', function test( t ) {
var v = sinpi( -0.0 );
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `+0` if provided `+0`', function test( t ) {
var v = sinpi( 0.0 );
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
t.end();
});

tape( 'if provided an integer, the function returns `+-0`', function test( t ) {
var expected;
var x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isNegativeZero = require( '@stdlib/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/assert/is-positive-zero' );
var isSameValue = require( '@stdlib/assert/is-same-value' );
var tryRequire = require( '@stdlib/utils/try-require' );

Expand Down Expand Up @@ -67,6 +69,18 @@ tape( 'if provided `NaN`, the function returns `NaN`', opts, function test( t )
t.end();
});

tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) {
var v = sinpi( -0.0 );
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `+0` if provided `+0`', opts, function test( t ) {
var v = sinpi( 0.0 );
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
t.end();
});

tape( 'if provided an integer, the function returns `+-0`', opts, function test( t ) {
var expected;
var x;
Expand Down
14 changes: 14 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/tan/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ var PI = require( '@stdlib/constants/float64/pi' );
var EPS = require( '@stdlib/constants/float64/eps' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var isNegativeZero = require( '@stdlib/assert/is-negative-zero' );
var isPositiveZero = require( '@stdlib/assert/is-positive-zero' );
var tan = require( './../lib' );


Expand Down Expand Up @@ -448,3 +450,15 @@ tape( 'if provided `-infinity`, the function returns `NaN`', function test( t )
t.equal( isnan( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `-0` if provided `-0`', function test( t ) {
var v = tan( -0.0 );
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `+0` if provided `+0`', function test( t ) {
var v = tan( 0.0 );
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
t.end();
});
14 changes: 14 additions & 0 deletions lib/node_modules/@stdlib/math/base/special/tan/test/test.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ var PI = require( '@stdlib/constants/float64/pi' );
var EPS = require( '@stdlib/constants/float64/eps' );
var PINF = require( '@stdlib/constants/float64/pinf' );
var NINF = require( '@stdlib/constants/float64/ninf' );
var isPositiveZero = require( '@stdlib/assert/is-positive-zero' );
var isNegativeZero = require( '@stdlib/assert/is-negative-zero' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand Down Expand Up @@ -457,3 +459,15 @@ tape( 'if provided `-infinity`, the function returns `NaN`', opts, function test
t.equal( isnan( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `-0` if provided `-0`', opts, function test( t ) {
var v = tan( -0.0 );
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
t.end();
});

tape( 'the function returns `+0` if provided `+0`', opts, function test( t ) {
var v = tan( 0.0 );
t.strictEqual( isPositiveZero( v ), true, 'returns expected value' );
t.end();
});