[ET Trac] [Einstein Toolkit] #1534: Bug in complex numbers

Einstein Toolkit trac-noreply at einsteintoolkit.org
Thu Feb 6 19:10:22 CST 2014


#1534: Bug in complex numbers
-----------------------+----------------------------------------------------
  Reporter:  eschnett  |       Owner:                     
      Type:  defect    |      Status:  review             
  Priority:  critical  |   Milestone:                     
 Component:  Cactus    |     Version:  development version
Resolution:            |    Keywords:                     
-----------------------+----------------------------------------------------
Changes (by rhaas):

  * status:  new => review


Comment:

 On comment:5: introducing a struct type for CCTK_COMPLEX in C seem
 undesirable. We'd loose the ability to to arithmetic on them even when
 using C99. We'd also have no guarantee anymore that it will look the same
 as Fortran's complex numbers (though I'd be surprised if they would), nor
 does C++ seem to require that the compiler actually implements complex
 numbers as a user visible class. As far as I remeber C++ allows the
 compiler to recognize "#include <complex>" and then map
 std::complex<double> to some internal representation about which is does
 not have to tell us anything.

 I checked the test results and the test failures in the ET when using
 32bit machines are indeed due to the 80bit math precision. Compiling with
 -mfpmath=sse -march=prescott (and -O0 though I doubt that matters since it
 alone did not help) I get the test (in PITTNull) to pass.

 Attached please find a patch for the flesh that removes the complex
 algebra helper routines and replaces them by inlined copies, one for C++
 and one for C. This leaves the case where a user defines C routine that
 returns CCTK_COMPLEX but calls it from C++ where we I don't know which
 calling convention is used for a routine declared extern "C".

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1534#comment:6>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list