Skip to content

Commit 0d53bc8

Browse files
committed
fix: correct imports to use max-nth-factorial constant
--- 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 6647a76 commit 0d53bc8

File tree

14 files changed

+40
-40
lines changed

14 files changed

+40
-40
lines changed

Diff for: lib/node_modules/@stdlib/math/base/special/factorial/lib/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
2424
var isInteger = require( '@stdlib/math/base/assert/is-integer' );
2525
var gamma = require( '@stdlib/math/base/special/gamma' );
2626
var PINF = require( '@stdlib/constants/float64/pinf' );
27-
var FLOAT64_MAX_SAFE_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-safe-nth-factorial' );
27+
var FLOAT64_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-nth-factorial' );
2828
var FACTORIALS = require( './factorials.json' );
2929

3030

@@ -72,7 +72,7 @@ function factorial( x ) {
7272
if ( x < 0 ) {
7373
return NaN;
7474
}
75-
if ( x <= FLOAT64_MAX_SAFE_NTH_FACTORIAL ) {
75+
if ( x <= FLOAT64_MAX_NTH_FACTORIAL ) {
7676
return FACTORIALS[ x ];
7777
}
7878
return PINF;

Diff for: lib/node_modules/@stdlib/math/base/special/factorial/manifest.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@stdlib/math/base/assert/is-integer",
4242
"@stdlib/math/base/special/gamma",
4343
"@stdlib/constants/float64/pinf",
44-
"@stdlib/constants/float64/max-safe-nth-factorial"
44+
"@stdlib/constants/float64/max-nth-factorial"
4545
]
4646
},
4747
{
@@ -59,7 +59,7 @@
5959
"@stdlib/math/base/assert/is-integer",
6060
"@stdlib/math/base/special/gamma",
6161
"@stdlib/constants/float64/pinf",
62-
"@stdlib/constants/float64/max-safe-nth-factorial"
62+
"@stdlib/constants/float64/max-nth-factorial"
6363
]
6464
},
6565
{
@@ -77,7 +77,7 @@
7777
"@stdlib/math/base/assert/is-integer",
7878
"@stdlib/math/base/special/gamma",
7979
"@stdlib/constants/float64/pinf",
80-
"@stdlib/constants/float64/max-safe-nth-factorial"
80+
"@stdlib/constants/float64/max-nth-factorial"
8181
]
8282
}
8383
]

Diff for: lib/node_modules/@stdlib/math/base/special/factorial/src/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "stdlib/math/base/assert/is_integer.h"
2222
#include "stdlib/math/base/special/gamma.h"
2323
#include "stdlib/constants/float64/pinf.h"
24-
#include "stdlib/constants/float64/max_safe_nth_factorial.h"
24+
#include "stdlib/constants/float64/max_nth_factorial.h"
2525
#include <stdint.h>
2626

2727
static const double FACTORIALS[ 171 ] = {
@@ -217,7 +217,7 @@ double stdlib_base_factorial( const double x ) {
217217
if ( x < 0.0 ) {
218218
return 0.0 / 0.0; // NaN
219219
}
220-
if ( x <= STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL ) {
220+
if ( x <= STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL ) {
221221
return FACTORIALS[ (int32_t)x ];
222222
}
223223
return STDLIB_CONSTANT_FLOAT64_PINF;

Diff for: lib/node_modules/@stdlib/math/base/special/falling-factorial/lib/main.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var floor = require( '@stdlib/math/base/special/floor' );
4141
var abs = require( '@stdlib/math/base/special/abs' );
4242
var FLOAT64_MAX = require( '@stdlib/constants/float64/max' );
4343
var PINF = require( '@stdlib/constants/float64/pinf' );
44-
var FLOAT64_MAX_SAFE_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-safe-nth-factorial' ); // eslint-disable-line id-length
44+
var FLOAT64_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-nth-factorial' );
4545

4646

4747
// FUNCTIONS //
@@ -177,10 +177,10 @@ function fallingFactorial( x, n ) {
177177
}
178178
if ( x < 0.5 ) {
179179
// Computing `1 + x` will throw away digits, so split up calculation...
180-
if ( n > FLOAT64_MAX_SAFE_NTH_FACTORIAL-2 ) {
180+
if ( n > FLOAT64_MAX_NTH_FACTORIAL-2 ) {
181181
// Given a ratio of two very large numbers, we need to split the calculation up into two blocks:
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
182+
t1 = x * fallingFactorial( x-1.0, FLOAT64_MAX_NTH_FACTORIAL-2 );
183+
t2 = fallingFactorial( x-FLOAT64_MAX_NTH_FACTORIAL+1.0, n-FLOAT64_MAX_NTH_FACTORIAL+1 ); // eslint-disable-line max-len
184184
if ( FLOAT64_MAX/abs(t1) < abs(t2) ) {
185185
return PINF;
186186
}

Diff for: lib/node_modules/@stdlib/math/base/special/falling-factorial/manifest.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@stdlib/math/base/special/abs",
4646
"@stdlib/constants/float64/max",
4747
"@stdlib/constants/float64/pinf",
48-
"@stdlib/constants/float64/max-safe-nth-factorial"
48+
"@stdlib/constants/float64/max-nth-factorial"
4949
]
5050
},
5151
{
@@ -67,7 +67,7 @@
6767
"@stdlib/math/base/special/abs",
6868
"@stdlib/constants/float64/max",
6969
"@stdlib/constants/float64/pinf",
70-
"@stdlib/constants/float64/max-safe-nth-factorial"
70+
"@stdlib/constants/float64/max-nth-factorial"
7171
]
7272
},
7373
{
@@ -89,7 +89,7 @@
8989
"@stdlib/math/base/special/abs",
9090
"@stdlib/constants/float64/max",
9191
"@stdlib/constants/float64/pinf",
92-
"@stdlib/constants/float64/max-safe-nth-factorial"
92+
"@stdlib/constants/float64/max-nth-factorial"
9393
]
9494
}
9595
]

Diff for: lib/node_modules/@stdlib/math/base/special/falling-factorial/src/main.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "stdlib/math/base/special/abs.h"
3939
#include "stdlib/constants/float64/max.h"
4040
#include "stdlib/constants/float64/pinf.h"
41-
#include "stdlib/constants/float64/max_safe_nth_factorial.h"
41+
#include "stdlib/constants/float64/max_nth_factorial.h"
4242
#include <stdint.h>
4343
#include <stdbool.h>
4444

@@ -160,10 +160,10 @@ double stdlib_base_falling_factorial( const double x, const int32_t n ) {
160160
}
161161
if ( x < 0.5 ) {
162162
// Computing `1 + x` will throw away digits, so split up calculation...
163-
if ( n > STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL - 2 ) {
163+
if ( n > STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL - 2 ) {
164164
// Given a ratio of two very large numbers, we need to split the calculation up into two blocks:
165-
t1 = x * stdlib_base_falling_factorial( x - 1.0, STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL - 2 );
166-
t2 = stdlib_base_falling_factorial( x - STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL + 1.0, n - STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL + 1 );
165+
t1 = x * stdlib_base_falling_factorial( x - 1.0, STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL - 2 );
166+
t2 = stdlib_base_falling_factorial( x - STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL + 1.0, n - STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL + 1 );
167167
if ( ( STDLIB_CONSTANT_FLOAT64_MAX / stdlib_base_abs( t1 ) ) < stdlib_base_abs( t2 ) ) {
168168
return STDLIB_CONSTANT_FLOAT64_PINF;
169169
}

Diff for: lib/node_modules/@stdlib/math/base/special/gamma-delta-ratio/lib/gamma_delta_ratio_lanczos.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var pow = require( '@stdlib/math/base/special/pow' );
4545
var EPSILON = require( '@stdlib/constants/float64/eps' );
4646
var E = require( '@stdlib/constants/float64/e' );
4747
var G = require( '@stdlib/constants/float64/gamma-lanczos-g' );
48-
var MAX_FACTORIAL = require( '@stdlib/constants/float64/max-safe-nth-factorial' );
48+
var FLOAT64_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-nth-factorial' );
4949

5050

5151
// VARIABLES //
@@ -80,8 +80,8 @@ function gammaDeltaRatioLanczos( z, delta ) {
8080
var zgh;
8181

8282
if ( z < EPSILON ) {
83-
if ( delta >= MAX_FACTORIAL ) {
84-
ratio = gammaDeltaRatioLanczos( delta, MAX_FACTORIAL-delta );
83+
if ( delta >= FLOAT64_MAX_NTH_FACTORIAL ) {
84+
ratio = gammaDeltaRatioLanczos( delta, FLOAT64_MAX_NTH_FACTORIAL-delta );
8585
ratio *= z;
8686
ratio *= FACTORIAL_169;
8787
return 1.0 / ratio;

Diff for: lib/node_modules/@stdlib/math/base/special/gamma-delta-ratio/lib/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var abs = require( '@stdlib/math/base/special/abs' );
4040
var floor = require( '@stdlib/math/base/special/floor' );
4141
var gamma = require( '@stdlib/math/base/special/gamma' );
4242
var factorial = require( '@stdlib/math/base/special/factorial' );
43-
var MAX_FACTORIAL = require( '@stdlib/constants/float64/max-safe-nth-factorial' );
43+
var FLOAT64_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-nth-factorial' );
4444
var gammaDeltaRatioLanczos = require( './gamma_delta_ratio_lanczos.js' );
4545

4646

@@ -87,7 +87,7 @@ function gammaDeltaRatio( z, delta ) {
8787
iz = floor( z );
8888
if ( iz === z ) {
8989
// As both `z` and `delta` are integers, see if we can use a table lookup:
90-
if ( z <= MAX_FACTORIAL && ( z + delta <= MAX_FACTORIAL ) ) {
90+
if ( z <= FLOAT64_MAX_NTH_FACTORIAL && ( z + delta <= FLOAT64_MAX_NTH_FACTORIAL ) ) {
9191
return factorial( iz - 1.0 ) / factorial( idelta + iz - 1.0 );
9292
}
9393
}

Diff for: lib/node_modules/@stdlib/math/base/special/gamma-delta-ratio/manifest.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@stdlib/math/base/special/log1p",
4646
"@stdlib/math/base/special/exp",
4747
"@stdlib/math/base/special/pow",
48-
"@stdlib/constants/float64/max-safe-nth-factorial",
48+
"@stdlib/constants/float64/max-nth-factorial",
4949
"@stdlib/constants/float64/eps",
5050
"@stdlib/constants/float64/e",
5151
"@stdlib/constants/float64/gamma-lanczos-g"
@@ -70,7 +70,7 @@
7070
"@stdlib/math/base/special/log1p",
7171
"@stdlib/math/base/special/exp",
7272
"@stdlib/math/base/special/pow",
73-
"@stdlib/constants/float64/max-safe-nth-factorial",
73+
"@stdlib/constants/float64/max-nth-factorial",
7474
"@stdlib/constants/float64/eps",
7575
"@stdlib/constants/float64/e",
7676
"@stdlib/constants/float64/gamma-lanczos-g"
@@ -95,7 +95,7 @@
9595
"@stdlib/math/base/special/log1p",
9696
"@stdlib/math/base/special/exp",
9797
"@stdlib/math/base/special/pow",
98-
"@stdlib/constants/float64/max-safe-nth-factorial",
98+
"@stdlib/constants/float64/max-nth-factorial",
9999
"@stdlib/constants/float64/eps",
100100
"@stdlib/constants/float64/e",
101101
"@stdlib/constants/float64/gamma-lanczos-g"

Diff for: lib/node_modules/@stdlib/math/base/special/gamma-delta-ratio/src/main.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "stdlib/math/base/special/floor.h"
3838
#include "stdlib/math/base/special/gamma.h"
3939
#include "stdlib/math/base/special/factorial.h"
40-
#include "stdlib/constants/float64/max_safe_nth_factorial.h"
40+
#include "stdlib/constants/float64/max_nth_factorial.h"
4141
#include "stdlib/math/base/special/gamma_lanczos_sum.h"
4242
#include "stdlib/math/base/special/log1p.h"
4343
#include "stdlib/math/base/special/exp.h"
@@ -72,8 +72,8 @@ static double gammaDeltaRatioLanczos( const double z, const double delta ) {
7272
double zgh;
7373

7474
if ( z < STDLIB_CONSTANT_FLOAT64_EPS ) {
75-
if ( delta >= STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL ) {
76-
ratio = gammaDeltaRatioLanczos( delta, STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL - delta );
75+
if ( delta >= STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL ) {
76+
ratio = gammaDeltaRatioLanczos( delta, STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL - delta );
7777
ratio *= z;
7878
ratio *= FACTORIAL_169;
7979
return 1.0 / ratio;
@@ -135,7 +135,7 @@ double stdlib_base_gamma_delta_ratio( const double z, const double delta ) {
135135
iz = stdlib_base_floor( z );
136136
if ( iz == z ) {
137137
// As both `z` and `delta` are integers, see if we can use a table lookup:
138-
if ( z <= STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL && ( z + delta <= STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL ) ) {
138+
if ( z <= STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL && ( z + delta <= STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL ) ) {
139139
return stdlib_base_factorial( iz - 1.0 ) / stdlib_base_factorial( idelta + iz - 1.0 );
140140
}
141141
}

Diff for: lib/node_modules/@stdlib/math/base/special/gammainc/lib/main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var FLOAT64_MAX = require( '@stdlib/constants/float64/max' );
4848
var SQRT_TWO_PI = require( '@stdlib/constants/float64/sqrt-two-pi' );
4949
var MAX_LN = require( '@stdlib/constants/float64/max-ln' );
5050
var PINF = require( '@stdlib/constants/float64/pinf' );
51-
var FLOAT64_MAX_SAFE_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-safe-nth-factorial' ); // eslint-disable-line id-length
51+
var FLOAT64_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-nth-factorial' );
5252
var finiteGammaQ = require( './finite_gamma_q.js' );
5353
var finiteHalfGammaQ = require( './finite_half_gamma_q.js' );
5454
var fullIGammaPrefix = require( './full_igamma_prefix.js' );
@@ -66,7 +66,7 @@ var upperGammaFraction = require( './upper_gamma_fraction.js' );
6666
*
6767
* ## Notes
6868
*
69-
* - When `a >= FLOAT64_MAX_SAFE_NTH_FACTORIAL` and computing the non-normalized incomplete gamma, result is rather hard to compute unless we use logs. There are really two options a) if `x` is a long way from `a` in value then we can reliably use methods 2 and 4 below in logarithmic form and go straight to the result. Otherwise we let the regularized gamma take the strain (the result is unlikely to underflow in the central region anyway) and combine with `lgamma` in the hopes that we get a finite result.
69+
* - When `a >= FLOAT64_MAX_NTH_FACTORIAL` and computing the non-normalized incomplete gamma, result is rather hard to compute unless we use logs. There are really two options a) if `x` is a long way from `a` in value then we can reliably use methods 2 and 4 below in logarithmic form and go straight to the result. Otherwise we let the regularized gamma take the strain (the result is unlikely to underflow in the central region anyway) and combine with `lgamma` in the hopes that we get a finite result.
7070
*
7171
* @param {NonNegativeNumber} x - function parameter
7272
* @param {PositiveNumber} a - function parameter
@@ -97,7 +97,7 @@ function gammainc( x, a, regularized, upper ) {
9797
normalized = ( regularized === void 0 ) ? true : regularized;
9898
invert = upper;
9999
result = 0.0;
100-
if ( a >= FLOAT64_MAX_SAFE_NTH_FACTORIAL && !normalized ) {
100+
if ( a >= FLOAT64_MAX_NTH_FACTORIAL && !normalized ) {
101101
if ( invert && ( a * 4.0 < x ) ) {
102102
// This is method 4 below, done in logs:
103103
result = ( a * ln(x) ) - x;

Diff for: lib/node_modules/@stdlib/math/base/special/riemann-zeta/lib/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var NINF = require( '@stdlib/constants/float64/ninf' );
4848
var TWO_PI = require( '@stdlib/constants/float64/two-pi' );
4949
var SQRT_EPSILON = require( '@stdlib/constants/float64/sqrt-eps' );
5050
var LN_SQRT_TWO_PI = require( '@stdlib/constants/float64/ln-sqrt-two-pi' );
51-
var MAX_SAFE_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-safe-nth-factorial' );
51+
var FLOAT64_MAX_NTH_FACTORIAL = require( '@stdlib/constants/float64/max-nth-factorial' );
5252
var FLOAT64_MAX_LN = require( '@stdlib/constants/float64/max-ln' );
5353
var ODD_POSITIVE_INTEGERS = require( './odd_positive_integers.json' );
5454
var EVEN_NONNEGATIVE_INTEGERS = require( './even_nonnegative_integers.json' );
@@ -262,7 +262,7 @@ function zeta( s ) {
262262
sc = tmp;
263263

264264
// Determine if computation will overflow:
265-
if ( s > MAX_SAFE_NTH_FACTORIAL ) {
265+
if ( s > FLOAT64_MAX_NTH_FACTORIAL ) {
266266
tmp = sinpi( 0.5*sc ) * 2.0 * zeta( s );
267267
r = gammaln( s );
268268
r -= s * ln( TWO_PI );

Diff for: lib/node_modules/@stdlib/math/base/special/riemann-zeta/manifest.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@stdlib/constants/float64/two-pi",
5353
"@stdlib/constants/float64/sqrt-eps",
5454
"@stdlib/constants/float64/ln-sqrt-two-pi",
55-
"@stdlib/constants/float64/max-safe-nth-factorial"
55+
"@stdlib/constants/float64/max-nth-factorial"
5656
]
5757
},
5858
{
@@ -81,7 +81,7 @@
8181
"@stdlib/constants/float64/two-pi",
8282
"@stdlib/constants/float64/sqrt-eps",
8383
"@stdlib/constants/float64/ln-sqrt-two-pi",
84-
"@stdlib/constants/float64/max-safe-nth-factorial"
84+
"@stdlib/constants/float64/max-nth-factorial"
8585
]
8686
},
8787
{
@@ -110,7 +110,7 @@
110110
"@stdlib/constants/float64/two-pi",
111111
"@stdlib/constants/float64/sqrt-eps",
112112
"@stdlib/constants/float64/ln-sqrt-two-pi",
113-
"@stdlib/constants/float64/max-safe-nth-factorial"
113+
"@stdlib/constants/float64/max-nth-factorial"
114114
]
115115
}
116116
]

Diff for: lib/node_modules/@stdlib/math/base/special/riemann-zeta/src/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include "stdlib/constants/float64/two_pi.h"
4747
#include "stdlib/constants/float64/sqrt_eps.h"
4848
#include "stdlib/constants/float64/ln_sqrt_two_pi.h"
49-
#include "stdlib/constants/float64/max_safe_nth_factorial.h"
49+
#include "stdlib/constants/float64/max_nth_factorial.h"
5050
#include <stdint.h>
5151

5252
static const int32_t MAX_BERNOULLI_2N = 129;
@@ -768,7 +768,7 @@ double stdlib_base_zeta( const double s ) {
768768
sc = tmp;
769769

770770
// Determine if computation will overflow:
771-
if ( scc > STDLIB_CONSTANT_FLOAT64_MAX_SAFE_NTH_FACTORIAL ) {
771+
if ( scc > STDLIB_CONSTANT_FLOAT64_MAX_NTH_FACTORIAL ) {
772772
tmp = stdlib_base_sinpi( 0.5 * sc ) * 2.0 * stdlib_base_zeta( scc );
773773
r = stdlib_base_gammaln( scc );
774774
r -= scc * stdlib_base_ln( STDLIB_CONSTANT_FLOAT64_TWO_PI );

0 commit comments

Comments
 (0)