Skip to content

Commit 2d4f12d

Browse files
committed
bench: update tolerances for the native tests
--- 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 --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: passed ---
1 parent 0937887 commit 2d4f12d

File tree

1 file changed

+9
-7
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/triangular/mgf/test

1 file changed

+9
-7
lines changed

lib/node_modules/@stdlib/stats/base/dists/triangular/mgf/test/test.native.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ tape( 'the function evaluates the MGF for `x` given a small range `b - a`', opts
107107
t.equal( y, expected[i], 'x: '+x[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
108108
} else {
109109
delta = abs( y - expected[ i ] );
110-
tol = 4.0 * EPS * abs( expected[ i ] );
110+
111+
// NOTE: The tolerance here is larger than that of the JavaScript implementation due to differences in the calculation of `expm1`, which result in a divergence of results. For more details, see the discussion at: https://github.com/stdlib-js/stdlib/pull/4768#discussion_r1921047716
112+
tol = 2.0 * EPS * abs( expected[ i ] );
111113
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
112114
}
113115
}
@@ -136,7 +138,7 @@ tape( 'the function evaluates the MGF for `x` given a medium range `b - a`', opt
136138
t.equal( y, expected[i], 'x: '+x[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
137139
} else {
138140
delta = abs( y - expected[ i ] );
139-
tol = 4.0 * EPS * abs( expected[ i ] );
141+
tol = 1.0 * EPS * abs( expected[ i ] );
140142
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
141143
}
142144
}
@@ -165,7 +167,7 @@ tape( 'the function evaluates the MGF for `x` given a large range `b - a`', opts
165167
t.equal( y, expected[i], 'x: '+x[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
166168
} else {
167169
delta = abs( y - expected[ i ] );
168-
tol = 4.0 * EPS * abs( expected[ i ] );
170+
tol = 1.0 * EPS * abs( expected[ i ] );
169171
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
170172
}
171173
}
@@ -194,7 +196,7 @@ tape( 'the function evaluates the MGF for `x` given the case: a < c < b', opts,
194196
t.equal( y, expected[i], 'x: '+x[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
195197
} else {
196198
delta = abs( y - expected[ i ] );
197-
tol = 4.0 * EPS * abs( expected[ i ] );
199+
tol = 1.0 * EPS * abs( expected[ i ] );
198200
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
199201
}
200202
}
@@ -223,7 +225,7 @@ tape( 'the function evaluates the MGF for `x` given the case: a < c = b', opts,
223225
t.equal( y, expected[i], 'x: '+x[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
224226
} else {
225227
delta = abs( y - expected[ i ] );
226-
tol = 4.0 * EPS * abs( expected[ i ] );
228+
tol = 1.0 * EPS * abs( expected[ i ] );
227229
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
228230
}
229231
}
@@ -252,7 +254,7 @@ tape( 'the function evaluates the MGF for `x` given the case: a = c < b', opts,
252254
t.equal( y, expected[i], 'x: '+x[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
253255
} else {
254256
delta = abs( y - expected[ i ] );
255-
tol = 4.0 * EPS * abs( expected[ i ] );
257+
tol = 1.0 * EPS * abs( expected[ i ] );
256258
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
257259
}
258260
}
@@ -281,7 +283,7 @@ tape( 'the function evaluates the MGF for `x` given the case: a = c = b', opts,
281283
t.equal( y, expected[i], 'x: '+x[i]+', a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
282284
} else {
283285
delta = abs( y - expected[ i ] );
284-
tol = 4.0 * EPS * abs( expected[ i ] );
286+
tol = 1.0 * EPS * abs( expected[ i ] );
285287
t.ok( delta <= tol, 'within tolerance. x: '+x[ i ]+'. a: '+a[i]+'. b: '+b[i]+'. c: '+c[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
286288
}
287289
}

0 commit comments

Comments
 (0)