File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
lib/node_modules/@stdlib/math/base/special/falling-factorial/lib Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,7 @@ var floor = require( '@stdlib/math/base/special/floor' );
41
41
var abs = require ( '@stdlib/math/base/special/abs' ) ;
42
42
var FLOAT64_MAX = require ( '@stdlib/constants/float64/max' ) ;
43
43
var PINF = require ( '@stdlib/constants/float64/pinf' ) ;
44
-
45
-
46
- // VARIABLES //
47
-
48
- var MAX_FACTORIAL = 170 ; // TODO: consider packaging as constant
44
+ var FLOAT64_MAX_SAFE_NTH_FACTORIAL = require ( '@stdlib/constants/float64/max-safe-nth-factorial' ) ; // eslint-disable-line id-length
49
45
50
46
51
47
// FUNCTIONS //
@@ -181,10 +177,10 @@ function fallingFactorial( x, n ) {
181
177
}
182
178
if ( x < 0.5 ) {
183
179
// Computing `1 + x` will throw away digits, so split up calculation...
184
- if ( n > MAX_FACTORIAL - 2 ) {
180
+ if ( n > FLOAT64_MAX_SAFE_NTH_FACTORIAL - 2 ) {
185
181
// Given a ratio of two very large numbers, we need to split the calculation up into two blocks:
186
- t1 = x * fallingFactorial ( x - 1.0 , MAX_FACTORIAL - 2 ) ;
187
- t2 = fallingFactorial ( x - MAX_FACTORIAL + 1.0 , n - MAX_FACTORIAL + 1 ) ;
182
+ t1 = x * fallingFactorial ( x - 1.0 , FLOAT64_MAX_SAFE_NTH_FACTORIAL - 2 ) ; // eslint-disable-line max-len
183
+ t2 = fallingFactorial ( x - FLOAT64_MAX_SAFE_NTH_FACTORIAL + 1.0 , n - FLOAT64_MAX_SAFE_NTH_FACTORIAL + 1 ) ; // eslint-disable-line max-len
188
184
if ( FLOAT64_MAX / abs ( t1 ) < abs ( t2 ) ) {
189
185
return PINF ;
190
186
}
You can’t perform that action at this time.
0 commit comments