From c6251c64b10800c53cc535adbedd92674dc87806 Mon Sep 17 00:00:00 2001 From: Nick Vatamaniuc Date: Thu, 15 May 2025 22:30:17 -0400 Subject: [PATCH] Increase the tolerance of approx acos and cbrt tests On engines which pass through these functions to the libc library they can return slightly different values depending on the OS and archictures. Showing a few example with Python, which also passes these through to libc on a few platforms I have access to: Ubuntu Noble, Python 12, s390x ``` >>> import math >>> math.cbrt(math.e) 1.3956124250860897 >>> math.acosh(math.cosh(0.2)) 0.20000000000000023 ``` Ubuntu Noble, Python 12, x86_64 ``` >>> import math >>> math.cbrt(math.e) 1.39561242508609 >>> math.acosh(math.cosh(0.2)) 0.20000000000000023 ``` MacOS 14, Python 12, x86_64 ``` >>> import math >>> math.cbrt(math.e) 1.3956124250860895 >>> math.acosh(math.cosh(0.2)) 0.20000000000000026 ``` --- test/staging/sm/Math/acosh-approx.js | 2 +- test/staging/sm/Math/cbrt-approx.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/staging/sm/Math/acosh-approx.js b/test/staging/sm/Math/acosh-approx.js index 502a4e4975..6af46bf582 100644 --- a/test/staging/sm/Math/acosh-approx.js +++ b/test/staging/sm/Math/acosh-approx.js @@ -273,7 +273,7 @@ var cosh_data = [ [1875817529344, 28.953212876533797] ]; -var sloppy_tolerance = 8; // FIXME +var sloppy_tolerance = 9; // FIXME for (var [x, y] of cosh_data) assertNear(Math.acosh(x), y, sloppy_tolerance); diff --git a/test/staging/sm/Math/cbrt-approx.js b/test/staging/sm/Math/cbrt-approx.js index c5123f1210..02095245df 100644 --- a/test/staging/sm/Math/cbrt-approx.js +++ b/test/staging/sm/Math/cbrt-approx.js @@ -22,6 +22,8 @@ var cbrt_data = [ [ Math.SQRT2, 1.1224620483093728 ] ]; -for (var [x, y] of cbrt_data) - assertNear(Math.cbrt(x), y); +var sloppy_tolerance = 3; + +for (var [x, y] of cbrt_data) + assertNear(Math.cbrt(x), y, sloppy_tolerance);