[Bug libgcc/64677] incorrect result with complex division?

spatel at rotateright dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 20 20:04:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64677

--- Comment #9 from Sanjay Patel <spatel at rotateright dot com> ---
(In reply to Sanjay Patel from comment #8)
> It seems I don't need the -std=c++11 flag as I do on OS X?

Actually, I screwed that up. We don't need that flag on OS X either...and
thankfully, the behavior matches Linux. This is on the same OS X (10.10) that I
was testing on when filing the bug:

$ g++ -O0 complex_div.cpp ; ./a.out 
 -0.0083223357032193145

$ g++ -O1 complex_div.cpp ; ./a.out 
 -0.0083223357032193145

$ g++ -O0 complex_div.cpp -std=c++11 ; ./a.out 
 -0.0083223357032193145

$ g++ -O1 complex_div.cpp -std=c++11 ; ./a.out 
 -0.0083223357032193128

So there are (at least) 2 questions:
1. Why does the answer change based on the -std?
2. What is the correct answer?



More information about the Gcc-bugs mailing list