https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79720
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|WAITING |NEW Target Milestone|--- |7.0 Summary|floating point result |[6/7 Regression] complex |different at compile time / |division different at |runtime |compile time / runtime --- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Here's a C test case. I chose the %a format for printf to better show what is going on: #include <complex.h> #include <stdio.h> #include <math.h> char input[] = "1.2e10 -3.2"; int main() { float complex c1, c2, r1, r2; float re, im; c1 = 1.2e10f - 3.2f*I; sscanf(input,"%f %f", &re, &im); c2 = re + im*I; printf("c1 = (%a, %a) c2 = (%a, %a)\n", crealf(c1), cimagf(c1), crealf(c2), cimagf(c2)); printf("c1 - c2 = (%a, %a)\n", crealf(c1)-crealf(c2), cimagf(c1)-cimagf(c2)); r1 = 1/c1; r2 = 1/c2; printf("r1 = (%a, %a) r2 = (%a, %a)\n", crealf(r1), cimagf(r1), crealf(r2), cimagf(r2)); printf("r1 - r2 = (%a, %a)\n", crealf(r1)-crealf(r2), cimagf(r1)-cimagf(r2)); return 0; } $ gcc -O re.c && ./a.out c1 = (0x1.65a0bcp+33, -0x1.99999ap+1) c2 = (0x1.65a0bcp+33, -0x1.99999ap+1) c1 - c2 = (0x0p+0, 0x0p+0) r1 = (0x1.6e80fep-34, 0x1.a3c414p-66) r2 = (0x1.6e80fep-34, 0x1.a3c412p-66) r1 - r2 = (0x0p+0, 0x1p-89) So, two ULP difference. There is no difference with gcc 4.3.2: tkoenig@gcc12:~$ gcc -O re.c tkoenig@gcc12:~$ ./a.out c1 = (0x1.65a0bcp+33, -0x1.99999ap+1) c2 = (0x1.65a0bcp+33, -0x1.99999ap+1) c1 - c2 = (0x0p+0, 0x0p+0) r1 = (0x1.6e80fep-34, 0x1.a3c412p-66) r2 = (0x1.6e80fep-34, 0x1.a3c412p-66) r1 - r2 = (0x0p+0, 0x0p+0) tkoenig@gcc12:~$ gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.3.2 (Debian 4.3.2-1.1) but gcc 6 and 7 fail.