Skip to content

Commit 9b266f0

Browse files
chore: add missing value and revert test.quantile.js
--- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - 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 9cab688 commit 9b266f0

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

lib/node_modules/@stdlib/stats/base/dists/levy/quantile/benchmark/benchmark.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ bench( pkg+':factory', function benchmark( b ) {
7676
mu = 10.0;
7777
c = 4.0;
7878
myquantile = quantile.factory( mu, c );
79+
80+
len = 100;
7981
p = new Float64Array( len );
8082

8183
for ( i = 0; i < len; i++ ) {
@@ -84,7 +86,7 @@ bench( pkg+':factory', function benchmark( b ) {
8486

8587
b.tic();
8688
for ( i = 0; i < b.iterations; i++ ) {
87-
y = myquantile( p );
89+
y = myquantile( p[ i % len ] );
8890
if ( isnan( y ) ) {
8991
b.fail( 'should not return NaN' );
9092
}

lib/node_modules/@stdlib/stats/base/dists/levy/quantile/test/test.quantile.js

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,15 @@ tape( 'the function evaluates the quantile function at `p` given positive `mu`',
102102
c = positiveMean.c;
103103
for ( i = 0; i < p.length; i++ ) {
104104
y = quantile( p[i], mu[i], c[i] );
105-
delta = abs( y - expected[ i ] );
106-
tol = 20.0 * EPS * abs( expected[ i ] );
107-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
105+
if ( expected[i] !== null ) {
106+
if ( y === expected[i] ) {
107+
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
108+
} else {
109+
delta = abs( y - expected[ i ] );
110+
tol = 20.0 * EPS * abs( expected[ i ] );
111+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
112+
}
113+
}
108114
}
109115
t.end();
110116
});
@@ -125,9 +131,15 @@ tape( 'the function evaluates the quantile function at `p` given negative `mu`',
125131
c = negativeMean.c;
126132
for ( i = 0; i < p.length; i++ ) {
127133
y = quantile( p[i], mu[i], c[i] );
128-
delta = abs( y - expected[ i ] );
129-
tol = 350.0 * EPS * abs( expected[ i ] );
130-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
134+
if ( expected[i] !== null ) {
135+
if ( y === expected[i] ) {
136+
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
137+
} else {
138+
delta = abs( y - expected[ i ] );
139+
tol = 350.0 * EPS * abs( expected[ i ] );
140+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
141+
}
142+
}
131143
}
132144
t.end();
133145
});
@@ -148,9 +160,15 @@ tape( 'the function evaluates the quantile function at `p` given large variance
148160
c = largeVariance.c;
149161
for ( i = 0; i < p.length; i++ ) {
150162
y = quantile( p[i], mu[i], c[i] );
151-
delta = abs( y - expected[ i ] );
152-
tol = 30.0 * EPS * abs( expected[ i ] );
153-
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
163+
if ( expected[i] !== null ) {
164+
if ( y === expected[i] ) {
165+
t.equal( y, expected[i], 'p: '+p[i]+', mu:'+mu[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
166+
} else {
167+
delta = abs( y - expected[ i ] );
168+
tol = 30.0 * EPS * abs( expected[ i ] );
169+
t.ok( delta <= tol, 'within tolerance. p: '+p[ i ]+'. mu: '+mu[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
170+
}
171+
}
154172
}
155173
t.end();
156174
});

0 commit comments

Comments
 (0)