Skip to content

Commit 354a54b

Browse files
committed
test: match tolerance used for JS implementation
--- 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: na - 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 321490b commit 354a54b

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/node_modules/@stdlib/stats/base/dists/chi/pdf/test/test.native.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ tape( 'if provided `-infinity` for `x` and a valid `k`, the function returns `0`
9292
t.end();
9393
});
9494

95-
tape( 'the function evaluates the pdf for given `x` and `k`', opts, function test( t ) {
95+
tape( 'the function evaluates the pdf for `x` given degrees of freedom `k`', function test( t ) {
9696
var expected;
9797
var delta;
9898
var tol;
@@ -105,16 +105,13 @@ tape( 'the function evaluates the pdf for given `x` and `k`', opts, function tes
105105
x = data.x;
106106
k = data.k;
107107
for ( i = 0; i < x.length; i++ ) {
108-
y = pdf( x[ i ], k[ i ] );
109-
if ( y === expected[ i ] ) {
110-
t.equal( y, expected[ i ], 'x: ' + x[ i ] + ', k: ' + k[ i ] + ', y: ' + y + ', expected: ' + expected[ i ] );
108+
y = pdf( x[i], k[i] );
109+
if ( y === expected[i] ) {
110+
t.equal( y, expected[i], 'x: '+x[i]+'. k:'+k[i]+', y: '+y+', expected: '+expected[i] );
111111
} else {
112112
delta = abs( y - expected[ i ] );
113-
tol = 2.0 * EPS * abs( expected[ i ] );
114-
if ( tol < 1e-14 ) {
115-
tol = 1e-14;
116-
}
117-
t.ok( delta <= tol, 'within tolerance. x: ' + x[ i ] + '. k: ' + k[ i ] + '. y: ' + y + '. E: ' + expected[ i ] + '. Δ: ' + delta + '. tol: ' + tol + '.' );
113+
tol = 140.0 * EPS * abs( expected[ i ] );
114+
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. k: '+k[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
118115
}
119116
}
120117
t.end();

0 commit comments

Comments
 (0)