From 9e7e9485795e5a89ae3c9a4f67c60a0abd9a44c6 Mon Sep 17 00:00:00 2001 From: Karan Anand Date: Sat, 5 Apr 2025 00:09:36 -0700 Subject: [PATCH] test: add tests for IEEE 754-2019 compliance --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/atan2d/test/test.js | 31 ++++++++++++++++--- .../base/special/atan2d/test/test.native.js | 31 ++++++++++++++++--- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/math/base/special/atan2d/test/test.js b/lib/node_modules/@stdlib/math/base/special/atan2d/test/test.js index dc453f49c516..203671413244 100644 --- a/lib/node_modules/@stdlib/math/base/special/atan2d/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/atan2d/test/test.js @@ -113,10 +113,17 @@ tape( 'the function returns `-135.0` if provided `x = y = -infinity`', function t.end(); }); -tape( 'the function returns `0.0` when `x = +infinity`', function test( t ) { - t.equal( atan2d( -2.0, PINF ), 0.0, 'returns expected value' ); - t.equal( atan2d( 0.0, PINF ), 0.0, 'returns expected value' ); - t.equal( atan2d( 2.0, PINF ), 0.0, 'returns expected value' ); +tape( 'the function returns `0.0` when `y > 0` and `x = +infinity`', function test( t ) { + t.equal( isPositiveZero( atan2d( 1.0, PINF ) ), true, 'returns expected value' ); + t.equal( isPositiveZero( atan2d( 2.0, PINF ) ), true, 'returns expected value' ); + t.equal( isPositiveZero( atan2d( 3.0, PINF ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `-0.0` when `y < 0` and `x = +infinity`', function test( t ) { + t.equal( isNegativeZero( atan2d( -1.0, PINF ) ), true, 'returns expected value' ); + t.equal( isNegativeZero( atan2d( -2.0, PINF ) ), true, 'returns expected value' ); + t.equal( isNegativeZero( atan2d( -3.0, PINF ) ), true, 'returns expected value' ); t.end(); }); @@ -155,13 +162,27 @@ tape( 'the function returns `90.0` if provided a positive `y` and `x=0`', functi t.end(); }); -tape( 'the function returns `90.0` if provided a negative `y` and `x=0`', function test( t ) { +tape( 'the function returns `90.0` if provided a positive `y` and `x=-0`', function test( t ) { + t.equal( atan2d( 2.0, -0.0 ), 90.0, 'returns expected value' ); + t.equal( atan2d( 1.0, -0.0 ), 90.0, 'returns expected value' ); + t.equal( atan2d( 0.5, -0.0 ), 90.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `-90.0` if provided a negative `y` and `x=0`', function test( t ) { t.equal( atan2d( -2.0, 0.0 ), -90.0, 'returns expected value' ); t.equal( atan2d( -1.0, 0.0 ), -90.0, 'returns expected value' ); t.equal( atan2d( -0.5, 0.0 ), -90.0, 'returns expected value' ); t.end(); }); +tape( 'the function returns `-90.0` if provided a negative `y` and `x=-0`', function test( t ) { + t.equal( atan2d( -2.0, -0.0 ), -90.0, 'returns expected value' ); + t.equal( atan2d( -1.0, -0.0 ), -90.0, 'returns expected value' ); + t.equal( atan2d( -0.5, -0.0 ), -90.0, 'returns expected value' ); + t.end(); +}); + tape( 'the function evaluates the `atan2d` function (when x and y are positive)', function test( t ) { var expected; var actual; diff --git a/lib/node_modules/@stdlib/math/base/special/atan2d/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/atan2d/test/test.native.js index 95fe93671576..f1412692121e 100755 --- a/lib/node_modules/@stdlib/math/base/special/atan2d/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/atan2d/test/test.native.js @@ -122,10 +122,17 @@ tape( 'the function returns `-135.0` if provided `x = y = -infinity`', opts, fun t.end(); }); -tape( 'the function returns `0.0` when `x = +infinity`', opts, function test( t ) { - t.equal( atan2d( -2.0, PINF ), 0.0, 'returns expected value' ); - t.equal( atan2d( 0.0, PINF ), 0.0, 'returns expected value' ); - t.equal( atan2d( 2.0, PINF ), 0.0, 'returns expected value' ); +tape( 'the function returns `0.0` when `y > 0` and `x = +infinity`', opts, function test( t ) { + t.equal( isPositiveZero( atan2d( 1.0, PINF ) ), true, 'returns expected value' ); + t.equal( isPositiveZero( atan2d( 2.0, PINF ) ), true, 'returns expected value' ); + t.equal( isPositiveZero( atan2d( 3.0, PINF ) ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `-0.0` when `y < 0` and `x = +infinity`', opts, function test( t ) { + t.equal( isNegativeZero( atan2d( -1.0, PINF ) ), true, 'returns expected value' ); + t.equal( isNegativeZero( atan2d( -2.0, PINF ) ), true, 'returns expected value' ); + t.equal( isNegativeZero( atan2d( -3.0, PINF ) ), true, 'returns expected value' ); t.end(); }); @@ -164,13 +171,27 @@ tape( 'the function returns `90.0` if provided a positive `y` and `x=0`', opts, t.end(); }); -tape( 'the function returns `90.0` if provided a negative `y` and `x=0`', opts, function test( t ) { +tape( 'the function returns `90.0` if provided a positive `y` and `x=-0`', opts, function test( t ) { + t.equal( atan2d( 2.0, -0.0 ), 90.0, 'returns expected value' ); + t.equal( atan2d( 1.0, -0.0 ), 90.0, 'returns expected value' ); + t.equal( atan2d( 0.5, -0.0 ), 90.0, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns `-90.0` if provided a negative `y` and `x=0`', opts, function test( t ) { t.equal( atan2d( -2.0, 0.0 ), -90.0, 'returns expected value' ); t.equal( atan2d( -1.0, 0.0 ), -90.0, 'returns expected value' ); t.equal( atan2d( -0.5, 0.0 ), -90.0, 'returns expected value' ); t.end(); }); +tape( 'the function returns `-90.0` if provided a negative `y` and `x=-0`', opts, function test( t ) { + t.equal( atan2d( -2.0, -0.0 ), -90.0, 'returns expected value' ); + t.equal( atan2d( -1.0, -0.0 ), -90.0, 'returns expected value' ); + t.equal( atan2d( -0.5, -0.0 ), -90.0, 'returns expected value' ); + t.end(); +}); + tape( 'the function evaluates the `atan2d` function (when x and y are positive)', opts, function test( t ) { var expected; var actual;