Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Apr 2021 21:34:31 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   =?UTF-8?B?W0J1ZyAyNTQ5MTFdIGxpYi9tc3VuL2N0cmlnX3Rlc3QgZmFpbHMg?= =?UTF-8?B?aWYgY29tcGlsZWQgd2l0aCBBVljCoCgtbWF2eCkgb3IgYW55IENQVVNFVCBl?= =?UTF-8?B?bmFibGluZyBBVlg=?=
Message-ID:  <bug-254911-227-Z1uWjjH16x@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-254911-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-254911-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D254911

--- Comment #2 from Dimitry Andric <dim@FreeBSD.org> ---
OK, for some reason the divide operation in the imaginary part in line 77 g=
ives
rise to FE_INVALID (0x1), but *only* if more advanced CPU instructions are
used:

    41  float complex
    42  ctanhf(float complex z)
    43  {
...
    72          t =3D tanf(y);
    73          beta =3D 1.0 + t * t;
    74          s =3D sinhf(x);
    75          rho =3D sqrtf(1 + s * s);
    76          denom =3D 1 + beta * s * s;
    77          return (CMPLXF((beta * rho * s) / denom, t / denom));

For example, one of the test cases has both x and y at zero, and this resul=
ts
in the values:

t=3D0, beta=3D1, s=3D0, rho=3D1, denom=3D1

The real part of the return statement calculates (beta * rho * s) / denom =
=3D (1
* 1 * 0) / 1 =3D 0, but this does *not* change the FP exception flags.

The imaginary part calculates t / denom =3D 0 / 1, and for some reason this=
 sets
FE_INVALID!

It's tricky to debug this using printfs though, since this also causes
FE_INEXACT, due to some floating point logic in the guts of printf.

Now, as to why compiling for bog-standard x86_64, which *does* use SSE and
SSE2, does not raise FE_INVALID, I'm not sure yet.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-254911-227-Z1uWjjH16x>