http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59714

            Bug ID: 59714
           Summary: complex division is inaccurate on aarch64
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael.hudson at linaro dot org

Hi, it seems details in the rounding of complex division are wrong:

ubuntu@arm64:~$ cat cplx.c
#include <stdio.h>

int main(int argc, char** argv)
{
 __complex double c = 1.0 + 3.0i;
 printf("%g\n", __imag__ (c/c));
}
ubuntu@arm64:~$ gcc cplx.c -o cplx
ubuntu@arm64:~$ ./cplx
-1.66533e-17

This is because libgcc2.c is compiled in a way that lets the compiler used
fused multiply add instructions. It shouldn't be!

(in this particular case, it's because if x is the closest float64 to 1/3,
evaluating "3*x - 1" using fnmsub does not yield 0 because of the lack of
intermediate rounding. Evaluating 3*x, rounding it, and then subtracting 1 does
yield 0).

Reply via email to