This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28408] What should be value of complex<double>(1.0,0.0) *= -1?
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Sep 2006 20:23:27 -0000
- Subject: [Bug c++/28408] What should be value of complex<double>(1.0,0.0) *= -1?
- References: <bug-28408-11211@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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