Skip to content

Commit 22ac2d2

Browse files
committed
refactor: use is-oddf instead of bitwise
--- 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 b76c750 commit 22ac2d2

File tree

2 files changed

+6
-6
lines changed
  • lib/node_modules/@stdlib/math/base/special/bernoullif

2 files changed

+6
-6
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var isNonNegativeIntegerf = require( '@stdlib/math/base/assert/is-nonnegative-integerf' );
2424
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
2525
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
26-
var isOdd = require( '@stdlib/math/base/assert/is-odd' );
26+
var isOddf = require( '@stdlib/math/base/assert/is-oddf' );
2727
var NINF = require( '@stdlib/constants/float32/ninf' );
2828
var PINF = require( '@stdlib/constants/float32/pinf' );
2929
var BERNOULLIF = require( './bernoullif.json' );
@@ -89,11 +89,11 @@ function bernoullif( n ) {
8989
if ( n === 1 ) {
9090
return 0.5;
9191
}
92-
if ( isOdd( n ) ) {
92+
if ( isOddf( n ) ) {
9393
return 0.0;
9494
}
9595
if ( n > MAX_BERNOULLI ) {
96-
return ( (n/2)&1 ) ? PINF : NINF;
96+
return ( isOddf( n/2.0 ) ) ? PINF : NINF;
9797
}
9898
return float64ToFloat32( BERNOULLIF[ n/2 ] );
9999
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ float stdlib_base_bernoullif( const float n ) {
7676
if ( !stdlib_base_is_nonnegative_integerf( n ) ) {
7777
return 0.0f / 0.0f; // NaN
7878
}
79-
if ( n == 1 ) {
79+
if ( n == 1.0f ) {
8080
return 0.5f;
8181
}
8282
if ( stdlib_base_is_oddf( n ) ) {
8383
return 0.0f;
8484
}
8585
if ( n > MAX_BERNOULLI ) {
86-
return ( (size_t)( n / 2 ) & 1 ) ? STDLIB_CONSTANT_FLOAT32_PINF : STDLIB_CONSTANT_FLOAT32_NINF;
86+
return ( stdlib_base_is_oddf( n/2.0f ) ) ? STDLIB_CONSTANT_FLOAT32_PINF : STDLIB_CONSTANT_FLOAT32_NINF;
8787
}
88-
return bernoulli_value[ (size_t)( n / 2 ) ];
88+
return bernoulli_value[ (size_t)( n / 2.0f ) ];
8989
}

0 commit comments

Comments
 (0)