File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
lib/node_modules/@stdlib/math/base/special/bernoullif Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 23
23
var isNonNegativeIntegerf = require ( '@stdlib/math/base/assert/is-nonnegative-integerf' ) ;
24
24
var float64ToFloat32 = require ( '@stdlib/number/float64/base/to-float32' ) ;
25
25
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 ' ) ;
27
27
var NINF = require ( '@stdlib/constants/float32/ninf' ) ;
28
28
var PINF = require ( '@stdlib/constants/float32/pinf' ) ;
29
29
var BERNOULLIF = require ( './bernoullif.json' ) ;
@@ -89,11 +89,11 @@ function bernoullif( n ) {
89
89
if ( n === 1 ) {
90
90
return 0.5 ;
91
91
}
92
- if ( isOdd ( n ) ) {
92
+ if ( isOddf ( n ) ) {
93
93
return 0.0 ;
94
94
}
95
95
if ( n > MAX_BERNOULLI ) {
96
- return ( ( n / 2 ) & 1 ) ? PINF : NINF ;
96
+ return ( isOddf ( n / 2.0 ) ) ? PINF : NINF ;
97
97
}
98
98
return float64ToFloat32 ( BERNOULLIF [ n / 2 ] ) ;
99
99
}
Original file line number Diff line number Diff line change @@ -76,14 +76,14 @@ float stdlib_base_bernoullif( const float n ) {
76
76
if ( !stdlib_base_is_nonnegative_integerf ( n ) ) {
77
77
return 0.0f / 0.0f ; // NaN
78
78
}
79
- if ( n == 1 ) {
79
+ if ( n == 1.0f ) {
80
80
return 0.5f ;
81
81
}
82
82
if ( stdlib_base_is_oddf ( n ) ) {
83
83
return 0.0f ;
84
84
}
85
85
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 ;
87
87
}
88
- return bernoulli_value [ (size_t )( n / 2 ) ];
88
+ return bernoulli_value [ (size_t )( n / 2.0f ) ];
89
89
}
You can’t perform that action at this time.
0 commit comments