std::arg() bug : not repetitive ?
Dave Korn
dave.korn.cygwin@googlemail.com
Tue Sep 1 17:00:00 GMT 2009
Marco Atzeri wrote:
> Hi DaveK,
> the following test case on complex numbers
> is producing, puzzling result on cygwin (both 1.5 and 1,7)
> with gcc-4.3.2 (and also 3.4.4), while working on other platform:
>
> #include <iostream>
> #include "oct-cmplx.h"
>
> int main ()
> {
> Complex z1 (1.0, 1.0), z2 (1.0, 1.0);
> std::cout << (arg(z1)) << '\n';
> std::cout << (arg(z2)) << '\n';
> std::cout << (arg(z1)<arg(z2)) << '\n';
> std::cout << (arg(z1)-arg(z2)) << '\n';
> }
>
>
> $ g++-4 comp_2.cc -o0 -o comp_2
>
> $ ./comp_2
> 0.785398
> 0.785398
> 1
> -3.06287e-17 <<-- arg(1+i) is lower then arg(1+i) !!
>
> Using different complex numbers is also possible to get
>
> arg(-1-i) bigger then arg(-1-i)
>
> Any idea what could cause it ? newlib ?
Or maybe it's PR323 (excess precision) in some aspect. Don't know yet, I'll
have to have a look into it.
cheers,
DaveK
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list