Skip to content

Commit 13303cd

Browse files
committed
test: add explanatory comments for high tolerance rationale
--- 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 2932c83 commit 13303cd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/node_modules/@stdlib/math/base/special/hyp2f1/test/test.native.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ tape( 'the function correctly evaluates the hypergeometric function', opts, func
175175
continue;
176176
}
177177
delta = abs( v - expected[ i ] );
178+
179+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
178180
tol = 1.2 * EPS * abs( expected[ i ] );
179181
t.ok( delta <= tol, 'within tolerance. a: ' + a[ i ] + ' b: ' + b[ i ] + ' c: ' + c[ i ] + ' x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '. Delta: ' + delta + '. Tolerance: ' + tol + '.' );
180182
}
@@ -205,6 +207,8 @@ tape( 'the function correctly evaluates the hypergeometric function', opts, func
205207
continue;
206208
}
207209
delta = abs( v - expected[ i ] );
210+
211+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
208212
tol = 24.0 * EPS * abs( expected[ i ] );
209213
t.ok( delta <= tol, 'within tolerance. a: ' + a[ i ] + ' b: ' + b[ i ] + ' c: ' + c[ i ] + ' x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '. Delta: ' + delta + '. Tolerance: ' + tol + '.' );
210214
}
@@ -235,6 +239,8 @@ tape( 'the function correctly evaluates the hypergeometric function', opts, func
235239
continue;
236240
}
237241
delta = abs( v - expected[ i ] );
242+
243+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
238244
tol = 32.0 * EPS * abs( expected[ i ] );
239245
t.ok( delta <= tol, 'within tolerance. a: ' + a[ i ] + ' b: ' + b[ i ] + ' c: ' + c[ i ] + ' x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '. Delta: ' + delta + '. Tolerance: ' + tol + '.' );
240246
}
@@ -265,6 +271,8 @@ tape( 'the function correctly evaluates the hypergeometric function', opts, func
265271
continue;
266272
}
267273
delta = abs( v - expected[ i ] );
274+
275+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
268276
tol = 84.0 * EPS * abs( expected[ i ] );
269277
t.ok( delta <= tol, 'within tolerance. a: ' + a[ i ] + ' b: ' + b[ i ] + ' c: ' + c[ i ] + ' x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '. Delta: ' + delta + '. Tolerance: ' + tol + '.' );
270278
}
@@ -292,12 +300,7 @@ tape( 'the function correctly evaluates the hypergeometric function', opts, func
292300
v = hyp2f1( a[ i ], b[ i ], c[ i ], x[ i ] );
293301
delta = abs( v - expected[ i ] );
294302

295-
/*
296-
* NOTE: the tolerance is set high in this case due to:
297-
*
298-
* 1. The expected values having a very large range, being either very small or very large.
299-
* 2. The function making a large number of internal calls, leading to accumulated numerical errors.
300-
*/
303+
// NOTE: the tolerance here is larger than for the JavaScript implementation due to compiler optimizations which may be performed resulting in result divergence. For discussion, see https://github.com/stdlib-js/stdlib/pull/2298#discussion_r1624765205
301304
tol = 345877.0 * EPS * abs( expected[ i ] );
302305
t.ok( delta <= tol, 'within tolerance. a: ' + a[ i ] + ' b: ' + b[ i ] + ' c: ' + c[ i ] + ' x: ' + x[ i ] + '. Value: ' + v + '. Expected: ' + expected[ i ] + '. Delta: ' + delta + '. Tolerance: ' + tol + '.' );
303306
}

0 commit comments

Comments
 (0)