holy8086 / cusp-library

Automatically exported from code.google.com/p/cusp-library
Apache License 2.0
0 stars 0 forks source link

Cast from complex to real is dangerous #72

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
#include <cusp/complex.h>
#include <iostream>
int main(void)
{
  cusp::complex<float> a = 1.0*cusp::complex<float>(1,1);
  std::cout << a << std::endl;
  return 0;
}

produces unexpected results.

Original issue reported on code.google.com by filipe.c...@gmail.com on 24 May 2011 at 10:02

GoogleCodeExporter commented 8 years ago
The following patch removes the cast from complex to real.
It doesn't seem to break any of the tests or examples.
If there are no complaints I'll commit it tomorrow.

Original comment by filipe.c...@gmail.com on 12 Jul 2011 at 9:16

Attachments:

GoogleCodeExporter commented 8 years ago
Sounds like a good idea to me.

Original comment by wnbell on 12 Jul 2011 at 10:08

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 22445b8c95f4.

Original comment by filipe.c...@gmail.com on 13 Jul 2011 at 10:52