Skip to content

Commit c1e1e15

Browse files
committed
refactor: use is-nonnegative-integer
--- 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: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - 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 ---
1 parent 2d3fe36 commit c1e1e15

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

lib/node_modules/@stdlib/math/base/special/factorial2/lib/main.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// MODULES //
2222

2323
var isnan = require( '@stdlib/math/base/assert/is-nan' );
24-
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
24+
var isNonnegativeInteger = require( '@stdlib/math/base/assert/is-nonnegative-integer' );
2525
var isEven = require( '@stdlib/math/base/assert/is-even' );
2626
var PINF = require( '@stdlib/constants/float64/pinf' );
2727
var FLOAT64_MAX_NTH_DOUBLE_FACTORIAL = require( '@stdlib/constants/float64/max-nth-double-factorial' ); // eslint-disable-line id-length
@@ -56,15 +56,12 @@ function factorial2( n ) {
5656
var out;
5757
var v;
5858
var i;
59-
if ( isnan( n ) ) {
59+
if ( isnan( n ) || !isNonnegativeInteger( n ) ) {
6060
return NaN;
6161
}
6262
if ( n > FLOAT64_MAX_NTH_DOUBLE_FACTORIAL ) {
6363
return PINF;
6464
}
65-
if ( n < 0 || isInteger( n ) === false ) {
66-
return NaN;
67-
}
6865
v = n|0; // asm type annotation
6966
if ( v === 0|0 || v === 1|0 ) {
7067
return 1|0; // asm type annotation

lib/node_modules/@stdlib/math/base/special/factorial2/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@stdlib/math/base/assert/is-even",
4141
"@stdlib/constants/float64/pinf",
4242
"@stdlib/constants/float64/max-nth-double-factorial",
43-
"@stdlib/math/base/assert/is-integer"
43+
"@stdlib/math/base/assert/is-nonnegative-integer"
4444
]
4545
},
4646
{
@@ -57,7 +57,7 @@
5757
"@stdlib/math/base/assert/is-even",
5858
"@stdlib/constants/float64/pinf",
5959
"@stdlib/constants/float64/max-nth-double-factorial",
60-
"@stdlib/math/base/assert/is-integer"
60+
"@stdlib/math/base/assert/is-nonnegative-integer"
6161
]
6262
},
6363
{
@@ -74,7 +74,7 @@
7474
"@stdlib/math/base/assert/is-even",
7575
"@stdlib/constants/float64/pinf",
7676
"@stdlib/constants/float64/max-nth-double-factorial",
77-
"@stdlib/math/base/assert/is-integer"
77+
"@stdlib/math/base/assert/is-nonnegative-integer"
7878
]
7979
}
8080
]

lib/node_modules/@stdlib/math/base/special/factorial2/src/main.c

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

1919
#include "stdlib/math/base/special/factorial2.h"
2020
#include "stdlib/math/base/assert/is_even.h"
21-
#include "stdlib/math/base/assert/is_integer.h"
21+
#include "stdlib/math/base/assert/is_nonnegative_integer.h"
2222
#include "stdlib/constants/float64/pinf.h"
2323
#include "stdlib/constants/float64/max_nth_double_factorial.h"
2424

@@ -37,7 +37,7 @@ double stdlib_base_factorial2( const double n ) {
3737
double out;
3838
double v;
3939
double i;
40-
if ( !stdlib_base_is_integer( n ) || n < 0.0 ) {
40+
if ( !stdlib_base_is_nonnegative_integer( n ) ) {
4141
return 0.0 / 0.0; // NaN
4242
}
4343
if ( n > STDLIB_CONSTANT_FLOAT64_MAX_NTH_DOUBLE_FACTORIAL ) {

0 commit comments

Comments
 (0)