On NetBSD 8.0/sparc64, I see a test failure of the fenv-rounding test for 'long double' operations. On this platform, 'long double' operations are implemented by a software floating-point library. Apparently this library code ignores the rounding direction.
This patch avoids the test failure and documents the problem. 2023-11-04 Bruno Haible <br...@clisp.org> fenv-rounding: Avoid a test failure on NetBSD/sparc64. * tests/test-fenv-round.c (test_towardzero, test_upward, test_downward): Skip the 'long double' tests on NetBSD/sparc64. * doc/posix-functions/fesetround.texi: Mention the problem with 'long double' operations on some platforms. diff --git a/doc/posix-functions/fesetround.texi b/doc/posix-functions/fesetround.texi index f0c74c3467..73d6c034fa 100644 --- a/doc/posix-functions/fesetround.texi +++ b/doc/posix-functions/fesetround.texi @@ -18,4 +18,7 @@ Portability problems not fixed by Gnulib: @itemize +@item +The rounding mode has no effect on @code{long double} operations on some platforms: +FreeBSD/arm64, NetBSD/sparc64. @end itemize diff --git a/tests/test-fenv-round.c b/tests/test-fenv-round.c index aba783cc79..b697fb1301 100644 --- a/tests/test-fenv-round.c +++ b/tests/test-fenv-round.c @@ -45,7 +45,7 @@ test_towardzero () a = -1; b = 3; q = a / b; p = b * q; ASSERT (p > a); } -#if !(defined __FreeBSD__ && defined __aarch64__) +#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */)) { long double volatile a, b, q, p; @@ -80,7 +80,7 @@ test_upward () a = -1; b = 3; q = a / b; p = b * q; ASSERT (p > a); } -#if !(defined __FreeBSD__ && defined __aarch64__) +#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */)) { long double volatile a, b, q, p; @@ -115,7 +115,7 @@ test_downward () a = -1; b = 3; q = a / b; p = b * q; ASSERT (p < a); } -#if !(defined __FreeBSD__ && defined __aarch64__) +#if !((defined __FreeBSD__ && defined __aarch64__) || (defined __NetBSD__ && defined __sparcv9 /* sparc64 */)) { long double volatile a, b, q, p;