diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-18 21:23:26 +0900 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2022-10-19 00:09:44 +0200 |
commit | 82c5487894c1610ba9021966603d1b35b2ff2e14 (patch) | |
tree | 8d06f020817226e7a44ba15b259418b06608d2c4 /src/test/test-math-util.c | |
parent | 50675bb98f44b2db90d7899150a5355c75e6df68 (diff) | |
download | systemd-82c5487894c1610ba9021966603d1b35b2ff2e14.tar.gz |
test: skip one test for iszero_safe() on i386 without SSE2
We do not provide any numerical libraries, and iszero_safe() is only
used in parsing or formatting JSON. Hence, it is not necessary for us to
request that the function provides the same result on different systems.
Fixes #25044.
Diffstat (limited to 'src/test/test-math-util.c')
-rw-r--r-- | src/test/test-math-util.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/test-math-util.c b/src/test/test-math-util.c index 891bbfc84a..0162bf7dc0 100644 --- a/src/test/test-math-util.c +++ b/src/test/test-math-util.c @@ -54,7 +54,16 @@ TEST(iszero_safe) { assert_se( iszero_safe(DBL_MIN / -INFINITY)); assert_se( iszero_safe(DBL_MAX / INFINITY / 2)); assert_se( iszero_safe(DBL_MAX / -INFINITY * DBL_MAX)); +#if defined(__i386__) && !defined(__SSE2_MATH__) + /* On 32bit x86, -mfpmath=387 is the default and SSE2 is not used. Then, floating point values are + * calculated in 80bit, and truncated to the length of the used type (double in this case). Hence, + * DBL_MAX * 2 is temporary calculated as a normal value, and goes to zero when divided with + * INFINITY. See issue #25044. */ + log_debug("i386 architecture without SSE2 is detected. " + "Skipping \"assert_se(!iszero_safe(DBL_MAX * 2 / INFINITY))\"."); +#else assert_se(!iszero_safe(DBL_MAX * 2 / INFINITY)); +#endif /* infinity / infinity is NaN */ assert_se(!iszero_safe(INFINITY / INFINITY)); |