Skip to content

Commit ad0e645

Browse files
committed
chore: apply suggestions from review
--- 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: passed - 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed ---
1 parent b729351 commit ad0e645

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

lib/node_modules/@stdlib/stats/base/dists/hypergeometric/pmf/manifest.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"@stdlib/math/base/special/factorialln",
4444
"@stdlib/math/base/special/max",
4545
"@stdlib/math/base/special/min",
46-
"@stdlib/math/base/assert/is-nonnegative-integer"
46+
"@stdlib/math/base/assert/is-nonnegative-integer",
47+
"@stdlib/math/base/assert/is-nan"
4748
]
4849
},
4950
{
@@ -63,7 +64,8 @@
6364
"@stdlib/math/base/special/max",
6465
"@stdlib/math/base/special/min",
6566
"@stdlib/math/base/special/round",
66-
"@stdlib/math/base/assert/is-nonnegative-integer"
67+
"@stdlib/math/base/assert/is-nonnegative-integer",
68+
"@stdlib/math/base/assert/is-nan"
6769
]
6870
},
6971
{
@@ -83,7 +85,8 @@
8385
"@stdlib/math/base/special/max",
8486
"@stdlib/math/base/special/min",
8587
"@stdlib/math/base/special/round",
86-
"@stdlib/math/base/assert/is-nonnegative-integer"
88+
"@stdlib/math/base/assert/is-nonnegative-integer",
89+
"@stdlib/math/base/assert/is-nan"
8790
]
8891
}
8992
]

lib/node_modules/@stdlib/stats/base/dists/hypergeometric/pmf/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "stdlib/stats/base/dists/hypergeometric/pmf.h"
2020
#include "stdlib/math/base/assert/is_nonnegative_integer.h"
21+
#include "stdlib/math/base/assert/is_nan.h"
2122
#include "stdlib/math/base/special/factorialln.h"
2223
#include "stdlib/math/base/special/exp.h"
2324
#include "stdlib/math/base/special/max.h"
@@ -44,7 +45,7 @@ double stdlib_base_dists_hypergeometric_pmf( const double x, const int32_t N, co
4445
double maxs;
4546
double mins;
4647

47-
if ( N < 0 || K < 0 || n < 0 || K > N || n > N ) {
48+
if ( stdlib_base_is_nan( x ) || N < 0 || K < 0 || n < 0 || K > N || n > N ) {
4849
return 0.0/0.0; // NaN
4950
}
5051

lib/node_modules/@stdlib/stats/base/dists/hypergeometric/pmf/test/test.native.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ tape( 'main export is a function', opts, function test( t ) {
4949
t.end();
5050
});
5151

52+
tape( 'if provided `NaN` for input value `x`, the function returns `NaN`', function test( t ) {
53+
var y = pmf( NaN, 10, 10, 5 );
54+
t.equal( isnan( y ), true, 'returns expected value' );
55+
t.end();
56+
});
57+
5258
tape( 'if provided an integer `x` greater than `min( n, K )`, the function returns `0` (provided all parameters are valid)', opts, function test( t ) {
5359
var y = pmf( 11.0, 20, 20, 10 );
5460
t.equal( y, 0.0, 'returns expected value' );

0 commit comments

Comments
 (0)