commit e74074f9142efdbb3abd9ff562fe6b123fdc6390
parent 020b987abdf0894b1f14afa57c007f81403ffe19
Author: Carlos Une <une@fastmail.fm>
Date: Mon, 30 Jan 2023 00:58:06 -0300
special case libc implementation-dependent test
For input (NaN, Inf), math::complex::tanc128 returns
(0f64 with sign of NaN, 1f64 with sign of Inf). However, the sign of bit of
NaN is set under glibc, but it is not set under musl, resulting in test
failure.
This patch compares the test result using the comparison operator.
0f64 == -0f64 is true on both glibc and musl.
References:
https://lists.sr.ht/~sircmpwn/hare-dev/patches/33328
https://lists.sr.ht/~sircmpwn/hare-dev/%3C2I5P65667M8XC.2AAFMEP64ZWLL%40mforney.org%3E
Signed-off-by: Carlos Une <une@fastmail.fm>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/math/complex/+test.ha b/math/complex/+test.ha
@@ -1374,6 +1374,11 @@ fn isexact(x: f64) bool =
// produced.
continue;
};
+ if (math::isnan(v.0.0) && math::isinf(v.0.1)) {
+ const r = tanc128(v.0);
+ assert(r.0 == v.1.0 && r.1 == v.1.1);
+ continue;
+ };
assert(calike(v.1, tanc128(v.0)));
// tan(conj(z)) == conj(tan(z))
assert (calike(conjc128(v.1), tanc128(conjc128(v.0)))