This is the mail archive of the cygwin mailing list for the Cygwin 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]

std::arg() bug : not repetitive ?


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


      

Attachment: oct-cmplx.h
Description: Binary data

Attachment: comp_2.cc
Description: Binary data

--
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

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