changeset 29789:c8585732ce08 stable

tests: Relax tolerance for tests on macOS. * libinterp/corefcn/mappers.cc (asin): Use larger tolerance for tests on macOS. * scripts/specfun/expint.m: Slightly relax tolerance for the test to also pass on macOS.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 20 Jun 2021 10:03:38 +0200
parents 4778b21b1386
children 10292fb30c8f
files libinterp/corefcn/mappers.cc scripts/specfun/expint.m
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/mappers.cc	Thu Jun 17 18:23:26 2021 +0200
+++ b/libinterp/corefcn/mappers.cc	Sun Jun 20 10:03:38 2021 +0200
@@ -322,12 +322,18 @@
 %! ival = 1.31695789692481635;
 %! obs = asin ([2, 2-i*eps, 2+i*eps]);
 %! exp = [rval - ival*i, rval - ival*i, rval + ival*i];
-%! assert (obs, exp, 2*eps);
+%! if (ismac ())
+%!   ## Math libraries on macOS seem to implement asin with less accuracy.
+%!   tol = 6*eps;
+%! else
+%!   tol = 2*eps;
+%! endif
+%! assert (obs, exp, tol);
 %! obs = asin ([-2, -2-i*eps, -2+i*eps]);
 %! exp = [-rval + ival*i, -rval - ival*i, -rval + ival*i];
-%! assert (obs, exp, 2*eps);
-%! assert (asin ([2 0]),  [rval - ival*i, 0], 2*eps);
-%! assert (asin ([2 0i]), [rval - ival*i, 0], 2*eps);
+%! assert (obs, exp, tol);
+%! assert (asin ([2 0]),  [rval - ival*i, 0], tol);
+%! assert (asin ([2 0i]), [rval - ival*i, 0], tol);
 
 ## Test large magnitude arguments (bug #45507)
 ## Test fails with older versions of libm, solution is to upgrade.
--- a/scripts/specfun/expint.m	Thu Jun 17 18:23:26 2021 +0200
+++ b/scripts/specfun/expint.m	Sun Jun 20 10:03:38 2021 +0200
@@ -254,7 +254,7 @@
 %!         9.018757389858152e-22 - 1.475771020004195e-21i, -4*eps);
 
 %!test <*47738>
-%! assert (expint (10i), 0.0454564330044554 + 0.0875512674239774i, -4*eps);
+%! assert (expint (10i), 0.0454564330044554 + 0.0875512674239774i, -5*eps);
 
 ## Test preservation or conversion of the class
 %!assert (class (expint (single (1))), "single")