std::arg() bug : not repetitive ?

Marco Atzeri marco_atzeri@yahoo.it
Tue Sep 1 16:21:00 GMT 2009


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 ?

Thanks
Marco


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oct-cmplx.h
Type: application/octet-stream
Size: 2150 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090901/a738228f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: comp_2.cc
Type: application/octet-stream
Size: 253 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20090901/a738228f/attachment-0001.obj>
-------------- next part --------------
--
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