This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/28408] What should be value of complex<double>(1.0,0.0) *= -1?



------- Comment #7 from pcarlini at suse dot de  2006-09-06 20:23 -------
Both the front-ends deal with 0 * -1 in the same way, the result is -0 (just
try). Anyway, the issue is crazy, a reduced pure C testcase (in principle
identical to what the complex<double> class does) behaves exactly the other way
'round about -O0 vs -O1:

#include <stdio.h>

int main()
{
  double __complex__ z;

  __real__ z = 1.0;
  __imag__ z = 0.0;

  z *= -1.0;

  printf("%e\n", __imag__(z));
}

I can't believe that both 0 and -0 are correct...


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]