One test in data.cc crashes Octave 3.1.51

Thomas Treichl Thomas.Treichl at gmx.net
Sat Aug 23 15:58:03 CDT 2008


John W. Eaton schrieb:
> On 21-Aug-2008, Thomas Treichl wrote:
> 
> | Thanks for the example program, I think we are getting closer. Now I can see (if 
> | I interpret this correctly) that the log function on my system cannot handle the 
> | complex type?! This would really be a bad thing
> 
> Sorry, that was a mistake on my part.  Try the following instead.  It
> should at least compile...
> 
> 
>   #include <iostream>
>   #include <cmath>
>   #include <complex>
> 
>   int
>   main (void)
>   {
>     double inf = 1.0 / 0.0;
> 
>     std::complex<double> foo
>       = std::log (std::complex<double> (0, inf)) / std::log (2);
> 
>     std::cout << foo << std::endl;
> 
>     return 0;
>   }

No problem.

I compiled the program the same way you did, but I always get the (inf,nan) 
answer from it on my 32bit i386 system - it doesn't matter which -O level I am 
using...

   ~/tmp $ g++ foo.cc
   ~/tmp $ ./a.out
   (inf,nan)
   ~/tmp $ g++ -O foo.cc
   ~/tmp $ ./a.out
   (inf,nan)
   ~/tmp $ g++ -O3 foo.cc
   ~/tmp $ ./a.out
   (inf,nan)

for PPC code running with the code translation backend on my i386 I always get 
(nan,nan)...

   ~/tmp $ g++ -arch ppc -isysroot /Developer/SDKs/MacOSX10.3.9.sdk foo.cc
   ~/tmp $ ./a.out
   (nan,nan)
   ~/tmp $ g++ -arch ppc -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -O foo.cc
   ~/tmp $ ./a.out
   (nan,nan)
   ~/tmp $ g++ -arch ppc -isysroot /Developer/SDKs/MacOSX10.3.9.sdk -O3 foo.cc
   ~/tmp $ ./a.out
   (nan,nan)

So both system results are different from the results that you can see on your 
system. I think that I could need another small portion of help about what I 
could/should do now.

Regards,

   Thomas


More information about the Bug-octave mailing list